Arrays of parameterized types are not allowed i.e.
ArrayList<Integer>[] group = new ArrayList<Integer>()[4]
Arrays of a ArrayList or any Java collection can be done as below
ArrayList<ArrayList<Integer>> group = new ArrayList<ArrayList<Integer>>(4);
Another way is if REALLY need array (bad design!):
ArrayList[] group = new ArrayList[4]; ArrayList group[] = new ArrayList[4]; ArrayList<Integer>[] group = new ArrayList[4]; ArrayList<Integer>[] group = (ArrayList<Integer>[])new ArrayList[4];
Code snippet of Array of Arraylist
ArrayList<ArrayList<Integer>> array = new ArrayList<ArrayList<Integer>>(5); for(int i =0; i < 5; i++) { ArrayList<Integer> s = new ArrayList<Integer>(); for (int j=0; j < 5; j++) { s.add(j); } array.add(s); }