@FunctionalInterface
public interface DoubleComparator
extends java.util.Comparator<java.lang.Double>
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 |
|---|---|
int |
compare(double k1,
double k2)
Compares its two primitive-type arguments for order.
|
default int |
compare(java.lang.Double ok1,
java.lang.Double ok2)
Deprecated.
Please use the corresponding type-specific method instead.
|
static <U extends java.lang.Comparable<? super U>> |
comparing(Double2ObjectFunction<? 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(Double2ObjectFunction<? 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 DoubleComparator |
comparingDouble(Double2DoubleFunction 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 DoubleComparator |
comparingInt(Double2IntFunction 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 DoubleComparator |
comparingLong(Double2LongFunction 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 DoubleComparator |
reversed() |
default java.util.Comparator<java.lang.Double> |
thenComparing(java.util.Comparator<? super java.lang.Double> second) |
default DoubleComparator |
thenComparing(DoubleComparator 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(double k1,
double k2)
Comparatordefault DoubleComparator reversed()
reversed in interface java.util.Comparator<java.lang.Double>@Deprecated
default int compare(java.lang.Double ok1,
java.lang.Double ok2)
compare in interface java.util.Comparator<java.lang.Double>default DoubleComparator thenComparing(DoubleComparator second)
Comparator.thenComparing(Comparator)default java.util.Comparator<java.lang.Double> thenComparing(java.util.Comparator<? super java.lang.Double> second)
thenComparing in interface java.util.Comparator<java.lang.Double>static <U extends java.lang.Comparable<? super U>> DoubleComparator comparing(Double2ObjectFunction<? 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>> DoubleComparator comparing(Double2ObjectFunction<? 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 DoubleComparator comparingInt(Double2IntFunction 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 DoubleComparator comparingLong(Double2LongFunction 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 DoubleComparator comparingDouble(Double2DoubleFunction 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