Package com.oracle.coherence.common.base
Class InverseComparator<T>
- java.lang.Object
-
- com.oracle.coherence.common.base.InverseComparator<T>
-
- All Implemented Interfaces:
Comparator<T>
public class InverseComparator<T> extends Object implements Comparator<T>
InverseComparator is a wrapper comparator which simply inverses the comparison result.- Author:
- mf 2014.08.28
-
-
Field Summary
Fields Modifier and Type Field Description protected Comparator<T>
f_comparator
The comparator to invert.static InverseComparator
INSTANCE
InverseComparator singleton which inverts a Comparable objects natural comparison order.
-
Constructor Summary
Constructors Constructor Description InverseComparator(Comparator<T> comparator)
Construct an InverseComparator which inverts the specified comparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(T o1, T o2)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Field Detail
-
f_comparator
protected final Comparator<T> f_comparator
The comparator to invert.
-
INSTANCE
public static final InverseComparator INSTANCE
InverseComparator singleton which inverts a Comparable objects natural comparison order.
-
-
Constructor Detail
-
InverseComparator
public InverseComparator(Comparator<T> comparator)
Construct an InverseComparator which inverts the specified comparator.- Parameters:
comparator
- the comparator to invert
-
-
Method Detail
-
compare
public int compare(T o1, T o2)
- Specified by:
compare
in interfaceComparator<T>
-
-