ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Making Java Objects Comparable
Subject:   Apache Jakarta Commons BeanUtils/Collections
Date:   2003-03-17 07:54:15
From:   anonymous2
The org.apache.commons packages help a great
deal with property based sorting:


ArrayList sortFields = new ArrayList();
sortFields.add(new BeanComparator("lastName"));
sortFields.add(new BeanComparator("firstName"));
ComparatorChain multiSort = new
ComparatorChain(sortFields);
java.util.Collections.sort(rows,multiSort);


See the Collections and BeanUtils packages at
http://jakarta.apache.org/commons/


1 to 2 of 2
1 to 2 of 2