sighol sighol - 4 months ago 6x
Java Question

Create an array of ArrayList<String> elements

I want to create an array that contains ArrayList<String> elements.

I've tried

ArrayList<String> name[] = new ArrayList<String>()[];

but that doesn't seem to work.


You cannot create an array of a generic type.

Instead, you can create an ArrayList<ArrayList<String>>.