-
Enhancement
-
Resolution: Fixed
-
P5
-
1.4.0
-
tiger
-
x86
-
windows_xp
Name: jl125535 Date: 01/28/2003
FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
A DESCRIPTION OF THE PROBLEM :
The Collections class provides a method (reverseOrder() ) to return a
Comparator which compares in the opposite order of the natural ordering, but
does not provide a comparator whose order is the reverse of the order of a
given Comparator (reverseOrder(Comparator) )
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER WORKAROUND :
Implement own Comparator to perform this functionality.
This is trivial, but that doesn't mean it can't be in the
standard library--For example, the unmodifiable* and
synchronized* factories of the Collections class are also
trivial to implement.
(While you're at it, use a WeakHashMap to map from
Comparators to their reverse orders to avoid duplicate
objects. Not that you wouldn't have done so anyways, of
course.)
(Review ID: 158662)
======================================================================