Back
I am wanting to create an array of arraylist like below:
ArrayList<Individual>[] group = new ArrayList<Individual>()[4]
But it's not compiling. How can I do this?
As per Oracle Documentation:
"You cannot create arrays of parameterized types"
Instead, you could do:
ArrayList<ArrayList<Individual>> group = new ArrayList<ArrayList<Individual>>(4);
tackline, it is even better to do:
List<List<Individual>> group = new ArrayList<List<Individual>>(4);
31k questions
32.8k answers
501 comments
693 users