ArrayList<String> al = new ArrayList();
//
// Code to populate al goes here
//
System.out.println("Original: ");
for (String str : al) {
System.out.println(" " + str);
}
// For amusement, just sort by comparing strings
Collections.sort(al);
System.out.println("Natural sort of the Strings: ");
for (String str : al) {
System.out.println(" " + str);
}
// The real goal: Sort by numeric value of the first item in the "num1-num2" Strings
Collections.sort(al, new CustomComparator());
System.out.println("CustomComparator sort of the Strings: ");
for (String str : al) {
System.out.println(" " + str);
}