Class InvertedOrderComparator

All Implemented Interfaces:

public final class InvertedOrderComparator
extends Object
implements Comparator

Comparator to do inverted total orderings on collections of objects.

Build this comparator with another comparator that does, for example, an ascending order of data. You can then use this class to impose a descending order on the same data.

Constructor Summary
InvertedOrderComparator(Comparator comparator)
          Creates a new InvertedOrderComparator instance.
Method Summary
 int compare(Object o1, Object o2)
          Compares two arguments for order.
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.rim.device.api.util.Comparator

Constructor Detail


public InvertedOrderComparator(Comparator comparator)
Creates a new InvertedOrderComparator instance.

comparator - Comparator whose ordering to invert.
Method Detail


public int compare(Object o1,
                   Object o2)
Compares two arguments for order.

This method simply invokes compare(o2,o1) on the Comparator parameter you passed to the constructor.

o1 - First object to compare.
o2 - Second object to compare.
Negative integer if the first object is 'greater than' the second; a positive integer if the second object is 'less than' the second; zero if the two objects are 'equal'.
JDE 4.0.2

Copyright 1999-2004 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.