net.rim.device.api.util
Class InvertedOrderComparator
java.lang.Object
|
+--net.rim.device.api.util.InvertedOrderComparator
- All Implemented Interfaces:
- Comparator
- 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.
InvertedOrderComparator
public InvertedOrderComparator(Comparator comparator)
- Creates a new InvertedOrderComparator instance.
- Parameters:
comparator - Comparator whose ordering to invert.
compare
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.
- Parameters:
o1 - First object to compare.o2 - Second object to compare.- Returns:
- 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'.
Copyright 1999-2009 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.