Thursday, March 26, 2009

Java Sorting a List


  1. http://java.sun.com/docs/books/tutorial/collections/interfaces/order.html
  2. Sample code

List e = new ArrayList(employees);

Collections.sort(e, new Comparator() {
public int compare(Employee e1, Employee e2) {
return e2.getFirstName().compareTo(e1.getFirstName());
}
}
);

No comments: