|
//set is going to be converted
List list = new ArrayList(set);
System.out.println(list.toString());
Collections.sort(list, new Comparator(){
public int compare(Object o1, Object o2) {
//Temp with Date type of attribute is a class.
Temp s1 = (Temp)o1;
Temp s2 = (Temp)o2;
return s2.date.compareTo(s1.date);
}
});
System.out.println(list.toString());
Hope that will help u. |
|