On Tue, 19 Mar 2002, Christoph Reck wrote: > In sorting "reverse" is a common terminology, the comparator is used to > sort. Ascending/Descending would be another term but is to much "point > of view" dependant. > > Just my EUR0.02...
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]>