ArrayList<ArrayList> bigList = new ArrayList<ArrayList>();
ArrayList liste = new ArrayList();
for(i=0 ; i<10 ; i++){
liste.add(0,i);
bigList.add(0, liste);
liste.clear( );
}
What I want to get is something like [ [9] [8]...[0] ]. Instead of that I'm getting [ [ ] [ ]...[ ] ], an ArrayList of empty ArrayLists...
liste seems to be a "pointer" on a list so when I clear it, I'm clearing all the sub ArrayLists..., isn't?
How to fix the loop to get [ [9] [8]...[0] ]?