Anonymous Classes
public static void main(String[] args) {
List<Integer> listOfInt = Arrays.asList(1,2,3,100,300,250,50,60,30,12,5,7,9);
listOfInt.sort(new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o1.compareTo(o2);
}
});
for(Integer obj: listOfInt){
System.out.println(obj);
}
}