I have an ArrayList of ArrayList of String.
In Outer ArrayList on each index each Inner ArrayList has four items have four parameters.
Use the following Comparator:
class MyComparator implements Comparator> {
private static int indexToCompare = 1;
@Override
public int compare(ArrayList o1, ArrayList o2) {
return o1.get(indexToCompare).compareTo(o2.get(indexToCompare));
}
}
Here indexToCompare
is the index of the arraylist which corresponds to Contact Name. In your case "1"