I wanted to know if it was possible to change
ArrayList<ArrayList<String>>
to String[][] in java. I do not think that the toArray() function would recurse inside its generic parameter. Any advice would be greatly appreciated.
You're right that toArray won't recurse. I'm afraid you'll have to do this manually. Something like:
List<List<String>> stringLists;
String[][] stringArrays = new String[stringLists.size()][];
int i = 0;
foreach (List<String> stringList: stringLists) {
stringArrays[i] = stringList.toArray(new String[stringList.size()]);
++i;
}
I haven't actually tried that, mind, so it could be rubbish.