Discussion Locked

Implement a BeanComparator

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
The Dec. 9, Java TechMail discusses the Jakarta Commons BeanComparator. Have you used the BeanComparator in your Java application development? Tell us about your experience.

1 reply

by bayard-generationjava

Note: Jakarta Commons BeanUtils now has such a BeanComparator in its API [In fact, very like it as it came from the code that lead to the tip and separate work from Eric Pugh].

This can be found at:
http://jakarta.apache.org/commons/beanutils.html
and the API seen at:
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/BeanComparator.html

Expect a getComparator/setComparator pair of methods to be added in the next release.

I've often found it hard to get people to click as to how useful BeanComparator is. Once it clicks, it clicks, but until then it's hard to convince people that BeanComparator does away with 95% of your comparators :)

[Also, pay attention to ReverseComparator in the Commons Collections project. Much nicer than using ASC/DESC flags]

This discussion is closed to new replies.