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
Comparators in the style of a lexical ordering.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionComparatorChain(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, waitMethods 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:
comparein interfaceComparator<T>
-