Class InvertedOrderComparator

  extended by net.rim.device.api.util.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.

Specified by:
compare in interface Comparator
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'.

Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.