Package org.opencms.file.collectors
Class ComparatorInverter
- java.lang.Object
-
- org.opencms.file.collectors.ComparatorInverter
-
- All Implemented Interfaces:
java.util.Comparator<I_CmsResource>
public final class ComparatorInverter extends java.lang.Object implements java.util.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
Constructors Constructor Description ComparatorInverter(java.util.Comparator<I_CmsResource> toInvert)
Creates a comparator that will invert the result of the given comparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(I_CmsResource o1, I_CmsResource o2)
-
-
-
Constructor Detail
-
ComparatorInverter
public ComparatorInverter(java.util.Comparator<I_CmsResource> toInvert)
Creates a comparator that will invert the result of the given comparator.- Parameters:
toInvert
- the comparator to invert results of
-
-
Method Detail
-
compare
public int compare(I_CmsResource o1, I_CmsResource o2)
- Specified by:
compare
in interfacejava.util.Comparator<I_CmsResource>
- See Also:
Comparator.compare(java.lang.Object, java.lang.Object)
-
-