I'm trying to make a program that is going to need to dynamically create ArrayLists along the lines of this:
for (int i = 0; i < arbitraryInt; i++){
//code to make 5 new arraylists
}
However I can't seem to find any method that would accomplish this.
Edit: I am trying to make a columnar cipher for my APCS class. This cipher requires me to convert a string of any length into a grid. In this case each arraylist would be a column. So to be more specific my code would look somewhat like this:
String encode = "somethingsomethingyadayadayada";
int x = 0, y = 0;
for (int i = 0; (i*i) < encode.length(); i++){
y = i;
x = i-1;
}
for (int i = 0; i < x; i++){
//make an arraylist
}
Is this better @Kartic? I tried to keep it non specific as to keep my post from becoming a code dump.
new ArrayList()5 times, or in a loop? or havingList<List<Integer>>?