I currently have an array of arrays and that would work fantastic, except I just realized that I don't know the length of all of the arrays that I need. So I have to switch to ArrayList
. I'm used to having an array of arrays and I know how to iterate through them. How do you do the same thing with ArrayList
s?
The following works... until I need to change line size through my iterations.
Person[][] nameList = new Person[yearsBack][lines];
for (int i=0; i<yearsBack; i++) {
for (int j=0; j<lines; j++) {
nameList[i][j] = new Person(name, gender, rank);