Create an Array of Arraylists
I am wanting to create an array of arraylist like below:
ArrayList[] group = new ArrayList()[4]
But it's not compiling. How can I do this?
As per Oracle Documentation you should follow the below-mentioned code to solve java array of arraylists:
"You cannot create arrays of parameterized types"
Instead, you could do:
ArrayList> group = new ArrayList>(4);
tackline, it is even better to do:
List> group = new ArrayList>(4);