Package org.opencms.file.collectors
Class ComparatorInverter
java.lang.Object
org.opencms.file.collectors.ComparatorInverter
- All Implemented Interfaces:
Comparator<I_CmsResource>
Wrapper around a comparator that inverts comparison results which may e.g. be
used to invert sort orders.
This is used to create
instances that may
sort in different order (ascending vs. descending).SortedSet
Internal comparator result | Transformed result |
---|---|
-1 | +1 |
0 | 0 |
+1 | -1 |
- Since:
- 7.0.3
-
Constructor Summary
ConstructorDescriptionComparatorInverter
(Comparator<I_CmsResource> toInvert) Creates a comparator that will invert the result of the given comparator. -
Method Summary
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
-
Constructor Details
-
ComparatorInverter
Creates a comparator that will invert the result of the given comparator.- Parameters:
toInvert
- the comparator to invert results of
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<I_CmsResource>
- See Also:
-