FW: [jdom-interest] Text class (Modified)

Alex Rosen arosen at silverstream.com
Fri Jun 1 09:59:15 PDT 2001


I certainly wasn't proposing that all JDOM objects implement Comparable. It's
just that Strings are Comparable, so if we added a Text class that wasn't
Comparable, we'd be taking away functionality.

However, I've since realized that you'd really never want to sort Text
objects - there will often be only one per Element, and if there's more than
one, the boundaries between them can be arbitrary. What you might want to do is
sort Elements based on their getText() value, to alphabetize a list. (Of
course, this is only one possible way to order Elements, so Element shouldn't
implement Comparable, but leave it up to the user to implement their own
Comparator.)

So, never mind.

Alex




More information about the jdom-interest mailing list