Skip to content
Advertisement

How to get first parameter from each 2D-array data in android studio using java

I have a String 2D-array named items in my app like this :

JavaScript

and I want to have a String ArrayList that include first parameter of each item data, something like this :

JavaScript

i used this code but unfortunately it didn’t work

JavaScript

Advertisement

Answer

You can also use streams to build this list:

JavaScript

If you still want to use a for loop go with (use < instead of <=):

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement