List of Arrays in Java

Firstly, you can't do new List(); it is an interface.

To make a list of int Arrays, do something like this :

List<int[]> myList = new ArrayList<int[]>();

P.S. As per the comment, package for List is java.util.List and for ArrayList java.util.ArrayList


List<Integer[]> integerList = new ArrayList<Integer[]>();

Use the object instead of the primitive, unless this is before Java 1.5 as it handles the autoboxing automatically.

As far as the sorting goes:

Collections.sort(integerList); //Sort the entire List  

and for each array (probably what you want)

for(Integer[] currentArray : integerList)  
{  
    Arrays.sort(currentArray);  
} 

Tags:

Java

Arrays

List