@FunctionalInterface
public interface IntComparator
extends java.util.Comparator<java.lang.Integer>
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.
Comparator| Modifier and Type | Method and Description |
|---|---|
default int |
compare(java.lang.Integer ok1,
java.lang.Integer ok2)
Deprecated.
Please use the corresponding type-specific method instead.
|
int |
compare(int k1,
int k2)
Compares its two primitive-type arguments for order.
|
static <U extends java.lang.Comparable<? super U>> |
comparing(Int2ObjectFunction<? extends U> keyExtractor)
Accepts a function that extracts a
Comparable sort key from
a primitive key, and returns a comparator that compares by that sort key. |
static <U extends java.lang.Comparable<? super U>> |
comparing(Int2ObjectFunction<? extends U> keyExtractor,
java.util.Comparator<? super U> keyComparator)
Accepts a function that extracts a sort key from a primitive key, and returns a
comparator that compares by that sort key using the specified
Comparator. |
static IntComparator |
comparingDouble(Int2DoubleFunction keyExtractor)
Accepts a function that extracts an
double sort key from a primitive key,
and returns a comparator that compares by that sort key. |
static IntComparator |
comparingInt(Int2IntFunction keyExtractor)
Accepts a function that extracts an
int sort key from a primitive key,
and returns a comparator that compares by that sort key. |
static IntComparator |
comparingLong(Int2LongFunction keyExtractor)
Accepts a function that extracts an
long sort key from a primitive key,
and returns a comparator that compares by that sort key. |
default IntComparator |
reversed() |
default java.util.Comparator<java.lang.Integer> |
thenComparing(java.util.Comparator<? super java.lang.Integer> second) |
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.
|
int compare(int k1,
int k2)
Comparatordefault IntComparator reversed()
reversed in interface java.util.Comparator<java.lang.Integer>@Deprecated
default int compare(java.lang.Integer ok1,
java.lang.Integer ok2)
compare in interface java.util.Comparator<java.lang.Integer>default IntComparator thenComparing(IntComparator second)
Comparator.thenComparing(Comparator)default java.util.Comparator<java.lang.Integer> thenComparing(java.util.Comparator<? super java.lang.Integer> second)
thenComparing in interface java.util.Comparator<java.lang.Integer>static <U extends java.lang.Comparable<? super U>> IntComparator comparing(Int2ObjectFunction<? extends U> keyExtractor)
Comparable sort key from
a primitive key, and returns a comparator that compares by that sort key.
The returned comparator is serializable if the specified function is also serializable.
keyExtractor - the function used to extract the Comparable sort keyjava.lang.NullPointerException - if keyExtractor is nullstatic <U extends java.lang.Comparable<? super U>> IntComparator comparing(Int2ObjectFunction<? extends U> keyExtractor, java.util.Comparator<? super U> keyComparator)
Comparator.
The returned comparator is serializable if the specified function and comparator are both serializable.
keyExtractor - the function used to extract the sort keykeyComparator - the Comparator used to compare the sort keyComparatorjava.lang.NullPointerException - if keyExtractor or keyComparator are nullstatic IntComparator comparingInt(Int2IntFunction keyExtractor)
int sort key from a primitive key,
and returns a comparator that compares by that sort key.
The returned comparator is serializable if the specified function is also serializable.
keyExtractor - the function used to extract the integer sort keyjava.lang.NullPointerException - if keyExtractor is nullstatic IntComparator comparingLong(Int2LongFunction keyExtractor)
long sort key from a primitive key,
and returns a comparator that compares by that sort key.
The returned comparator is serializable if the specified function is also serializable.
keyExtractor - the function used to extract the long sort keyjava.lang.NullPointerException - if keyExtractor is nullstatic IntComparator comparingDouble(Int2DoubleFunction keyExtractor)
double sort key from a primitive key,
and returns a comparator that compares by that sort key.
The returned comparator is serializable if the specified function is also serializable.
keyExtractor - the function used to extract the double sort keyjava.lang.NullPointerException - if keyExtractor is null