What is the simplest way to just iterate over ArrayList rows values?
For example I have two ArrayList:
ArrayList<Object> main = new ArrayList<Object>();
ArrayList<Object> row = new ArrayList<Object>();
I use two fors to add values into main. First I add row, then when row iterations end, I add it to main, and then repeat for another row etc. For example:
for(int i=0; i < somearray.length; i++){
for(int j=0; j < somearray2.length; j++){
if(somearray2[j] == true)
row.add(somearray2[j]);
}
main.add(row);
}
So now I get ArrayList filled with rows like I need. But later I need to iterate over rows values, not just rows themselves from main ArrayList. How can I do that?
As I only see the method:
main.get(index), which let's me get a row, but nothing more.