| Senior |
 |
Joined: Wed Aug 17, 2005 12:56 pm Posts: 136 Location: Erie, PA (USA)
|
|
You can use Collections.sort(...) to sort a collection. You need a comparator. There is code in Commons that may help:
i.e.
ComparatorChain mSort = new ComparatorChain();
mSort.addComparator(new BeanComparator("sortProp1"), false);
mSort.addComparator(new BeanComparator("sortProp2"), false);
Collections.sort(dataSet, mSort);
We have used this several places where we didn't want to duplicate query code just to put the results into a different order. While we haven't had any problems, I would think that very large collections could pose some problems.
Curtis ...
|
|