Tuesday, September 4, 2012

Collections.sort java: sorting java object




//Sort aktlist
final Comparator< aktlist > DATE_ORDER =
                            new Comparator< aktlist >() {
@Override
public int compare( aktlist a1,  aktlist a2) {
   return a2.getDatum().compareTo(a1.getDatum());
}
};
Collections.sort( aktlist , DATE_ORDER);

More information:
http://docs.oracle.com/javase/tutorial/collections/interfaces/order.html

No comments:

Post a Comment