Package it.unimi.dsi.fastutil.ints
Interface IntComparator
- All Superinterfaces:
Comparator<Integer>
- All Known Implementing Classes:
AbstractIntComparator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface IntComparator extends Comparator<Integer>
A type-specific
Comparator
; provides methods to compare two primitive
types both as objects and as primitive types.
Note that fastutil
provides a corresponding abstract class that can
be used to implement this interface just by specifying the type-specific
comparator.
- See Also:
Comparator
-
Method Summary
Modifier and Type Method Description int
compare(int k1, int k2)
Compares its two primitive-type arguments for order.default int
compare(Integer ok1, Integer ok2)
Deprecated.Please use the corresponding type-specific method instead.default IntComparator
reversed()
default IntComparator
thenComparing(IntComparator second)
Return a new comparator that first uses this comparator, then uses the second comparator if this comparator compared the two elements as equal.default Comparator<Integer>
thenComparing(Comparator<? super Integer> second)
Methods inherited from interface java.util.Comparator
equals, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Method Details
-
compare
int compare(int k1, int k2)Compares its two primitive-type arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
- See Also:
Comparator
-
reversed
- Specified by:
reversed
in interfaceComparator<Integer>
-
compare
Deprecated.Please use the corresponding type-specific method instead.This implementation delegates to the corresponding type-specific method.
- Specified by:
compare
in interfaceComparator<Integer>
-
thenComparing
Return a new comparator that first uses this comparator, then uses the second comparator if this comparator compared the two elements as equal.- See Also:
Comparator.thenComparing(Comparator)
-
thenComparing
- Specified by:
thenComparing
in interfaceComparator<Integer>
-