Shubham Urkade :
I'm creating an array of ArrayLists using the following code:
ArrayList<Integer>[] list = new ArrayList[n];
As it is said that array of generics is not allowed. How is that my code compiles?
A.Najafi :
Because you are initializing an array not the ArrayList Look at this:
ElementType [] name = new ElementType[size];
Here your element type is ArrayList
Look at this site:Array of ArrayList