On Thu, 28 Feb 2002, Morgan Delagrange wrote:
> First, I'm not sure all of these Comparators are generic enough to include
> in Collections.  ComparableComparator and ReverseComparator seem to be right
> on.  NumericStringComparator, PackageNameComparator, and UrlComparator seem
> too specific for Collections though.

I'm just curious, but why do you feel they are too specific?  If someone
whants to create a TreeSet (or FastTreeSet, or pretty much any ordered
set), which contains URLs, a URL comparator might be useful.  And it
doesn't seem to make as much sense to have the URL comparator in a net
component.

> It seems that if a Collection or Comparator would seem out of place in the
> JDK, it's not a good candidate for Collections.  PackageNameComparator and
> UrlComparator in particular seem out of place.  Most comparators are highly
> specific, and comparators are also very easy to write.  Consequently, we
> should be wary of which Comparators we include.  Bay, would you object to
> removing NumericStringComparator, PackageNameComparator and UrlComparator?

these comparators (by name only) seem generic enough.  They don't depend 
on anything other than what's already in the JDK (String, URL).  I would 
agree that they would be out of place if the comparator was comparing 
things that are not in the JDK though.  More specifically, a comparator 
that depends on something other than stuff in the JDK is probably too 
specific and would be out of place.  I'm just not sure that theese 
comparators are.

I'm not sure that "easy to write" is a great argument for excluding them.  
If it was, we wouldn't include things like ProxyIterator,
SingletonIterator, or even IteratorEnumeraation.  Having the ability to
reuse code rather than just redo it (even if it is simple) is one of the
tenets of the commons project.

> Second, none of the Comparators are Serializable.  Shouldn't they be, so
> that their corresponding Collections will be serializable?

that's probably a good idea.  :)


michael



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to