com.jalios.util
Class ReverseComparator<T>
java.lang.Object
com.jalios.util.ReverseComparator<T>
- All Implemented Interfaces:
- Comparator<T>
public class ReverseComparator<T>
- extends Object
- implements Comparator<T>
This class is comparator which reverse the ordering of a given comparator.
- Version:
- $Revision: 21407 $
- Author:
- Olivier Dedieu
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REVISION
public static final String REVISION
- See Also:
- Constant Field Values
comparator
protected Comparator<T> comparator
ReverseComparator
public ReverseComparator()
- Defaut constructor reverse NaturalComparator
Objects mus be Comparable
ReverseComparator
public ReverseComparator(Comparator<T> comparator)
- This constructor will reverse returned value
by given comparator.
- Parameters:
comparator
- used to compare object
getReversedComparator
public Comparator<T> getReversedComparator()
- Retrieve the Comparator this ReverseComparator is reversing
or null when the natural Comparator is reversed.
- Returns:
- the Comparator instance being used or null if we are
reversing the natural Comparator of the objects.
compare
public int compare(T o1,
T o2)
- Specified by:
compare
in interface Comparator<T>
Copyright © 2001-2010 Jalios SA. All Rights Reserved.