Package org.bremersee.comparator
Class ComparatorChain
java.lang.Object
org.bremersee.comparator.ComparatorChain
- All Implemented Interfaces:
Comparator<Object>
The comparator chain has a list of comparators. Beginning with the first each comparator is
invoked as long the previous one returns zero on
Comparator.compare(Object, Object).- Author:
- Christian Bremer
-
Constructor Summary
ConstructorsConstructorDescriptionComparatorChain(List<Comparator> comparators) Instantiates a new comparator chain. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
ComparatorChain
Instantiates a new comparator chain.- Parameters:
comparators- the comparators (can benullor empty)
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<Object>
-