Web Development

General discussion


Implement a BeanComparator

By Mark W. Kaelin Editor ·
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.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -


by bayard In reply to Implement a BeanComparato ...

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:
and the API seen at:

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]

Related Discussions

Related Forums