[Solved] ArrayList.size() returns size of field, not the size of the List, why? [closed]


Note, you don’t need the size of the arraylist to iterate over it. You can simply do

for (Entity e : myList){
    //Do stuff with e
}

If you do need the index and hence need to call .size(), please post some sample code so someone can see what’s going wrong.

7

solved ArrayList.size() returns size of field, not the size of the List, why? [closed]