Michael suggested that the no-op constructor essentially behave like this:

  ReverseComparator() {
      this(ComparableComparator.getInstance());
  }

What do you think, Hen?  Do you think that is preferable, or do you prefer
your initial behaviour (reversing the List).


----- Original Message -----
From: "Henri Yandell" <[EMAIL PROTECTED]>
To: "Jakarta Commons Developers List" <[EMAIL PROTECTED]>
Sent: Tuesday, March 19, 2002 7:50 AM
Subject: Re: [collections] ReverseComparator


>
> I'm happy with the name Inverse as it is more what the comparator does.
> Reverse makes it easier to see how it can be used for one case, but will
> hide other meanings.
>
> Why does this exist over Collections.reverseOrder? Because the Sun version
> is limited. Why can I only reverse Comparables? Really there should be a
> Collections.reverseOrder(Comparator) as well.
>
> Hen
>
> > I agree that reverse is common terminology when sorting, but I disagree
> > that sorting is intrinsicly what a comparator does. While sorting is
> > probably the most common use-case for comparators, the comparator itself
> > does not do any sorting.  It compares objects and returns a negative,
zero
> > value, or positive result.  It doesn't rearrange, reverse, order, or
> > "sort".  It just compares two objects. This particular comparator
> > "inverses" the result of the compare to be a positive, zero value, or
> > negative result (respectively).  I use "inverse" here in its
mathematical
> > sense of inverting the result, since that's all this comparator is
doing.
> >
> > I'm not going to argue this anymore though.  I've changed my position --
> > why is this class even included in commons when the JDK provides a
> > reverse/inverse comparator already?  @see Collections.reverseOrder()
> >
> > regards,
> > michael
> >
> > > "Michael A. Smith" wrote:
> > > >[snip]
> > > > Additionally, I think that "InverseComparator" is a more appropriate
name,
> > > > as "inverse" has a more direct meaning (to me at least).  Inverse
has the
> > > > mathematical meaning of the opposite sign which is exactly what this
> > > > comparator does.  Reverse, on the other hand, implies switching the
order
> > > > of something, the comparator isn't really switching the order
(although a
> > > > collection using the comparator may be "reversed" if it uses the
"inverse"
> > > > comparator).
> > > >
> > > > Thoughts?
> > > >[snip]
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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

Reply via email to