Class IntComparatorChain
- java.lang.Object
-
- tech.tablesaw.sorting.comparators.IntComparatorChain
-
- All Implemented Interfaces:
it.unimi.dsi.fastutil.ints.IntComparator,Serializable,Comparator<Integer>
public class IntComparatorChain extends Object implements it.unimi.dsi.fastutil.ints.IntComparator, Serializable
An IntComparator that wraps one or more Comparators in sequence. The ComparatorChain calls each Comparator in sequence until either 1) any single Comparator returns a non-zero result (and that result is then returned), or 2) the ComparatorChain is exhausted (and zero is returned)The implementation is based on Apache Commons Collections
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IntComparatorChain(it.unimi.dsi.fastutil.ints.IntComparator comparator)Constructs a comparator chain with the argument as the first node in the chain
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddComparator(it.unimi.dsi.fastutil.ints.IntComparator comparator)Appends the comparator to the end of the chainintcompare(int o1, int o2)booleanequals(Object object)inthashCode()intsize()Returns the number of comparators in the chain-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Method Detail
-
addComparator
public void addComparator(it.unimi.dsi.fastutil.ints.IntComparator comparator)
Appends the comparator to the end of the chain
-
size
public int size()
Returns the number of comparators in the chain
-
compare
public int compare(int o1, int o2) throws UnsupportedOperationException- Specified by:
comparein interfaceit.unimi.dsi.fastutil.ints.IntComparator- Throws:
UnsupportedOperationException
-
-