Package eu.bandm.tools.util
Class ComparatorChain<T>
java.lang.Object
eu.bandm.tools.util.ComparatorChain<T>
- All Implemented Interfaces:
Comparator<T>
Combines more than one
Comparator
s in the style of a lexical ordering.-
Field Summary
-
Constructor Summary
ConstructorDescriptionComparatorChain
(Comparator<? super T>... cs) Takes a sequence of comparators, ranging from the "coarsest" to "finest". -
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
-
Field Details
-
comparators
-
-
Constructor Details
-
ComparatorChain
Takes a sequence of comparators, ranging from the "coarsest" to "finest".
-
-
Method Details
-
compare
Tries the comparators from the first to the last. Returns the first comparison result!=0
, or the very last.- Specified by:
compare
in interfaceComparator<T>
-