@FunctionalInterface
public interface FloatOrdering
Compared to a Comparator<Float> this can
avoid boxing and unboxing in various situations.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
FloatOrdering.Serial
A float ordering which is serializable.
|
| Modifier and Type | Field and Description |
|---|---|
static FloatOrdering |
NATURAL_ASCENDING
Natural order of ascending
float values. |
static FloatOrdering |
NATURAL_DESCENDING
Natural order of descending
float values. |
static FloatOrdering |
STANDARD_ASCENDING
Standard Java order of ascending
float values. |
static FloatOrdering |
STANDARD_DESCENDING
Inverse standard Java order of
float values. |
| Modifier and Type | Method and Description |
|---|---|
default boolean |
ascending(float v1,
float v2)
Are the two values represented in strictly ascending order?
|
default boolean |
ascendingOrSame(float v1,
float v2)
Are the two values represented in ascending order?
|
default java.util.Comparator<java.lang.Float> |
asFloatComparator()
Use this ordering as a comparator.
|
default Ordering<java.lang.Float> |
asFloatOrdering()
Get this ordering as a generic float ordering.
|
default java.util.Comparator<java.lang.Number> |
asNumberComparator()
View this ordering as a number comparator.
|
Order |
checkFloat(float v1,
float v2)
Get the order of the two values.
|
default boolean |
descending(float v1,
float v2)
Are the two values represented in strictly descending order?
|
default boolean |
descendingOrSame(float v1,
float v2)
Are the two values represented in descending order?
|
default boolean |
different(float v1,
float v2)
Are the two values considered different by this order?
|
static FloatOrdering |
fromComparator(java.util.Comparator<java.lang.Float> comparator)
Convert a standard comparator of
Double into a double ordering. |
default FloatOrdering |
inverse()
Invert this order.
|
default boolean |
same(float v1,
float v2)
Are the two values considered equal by this order?
|
static final FloatOrdering NATURAL_ASCENDING
float values.
Besides collapsing all NaN values and ordering them between
everything else this ordering is nearer to IEEE 784 than
standard Float.compare(float, float).Primitives.order(float, float),
STANDARD_ASCENDINGstatic final FloatOrdering NATURAL_DESCENDING
float values.
Besides collapsing all NaN values and ordering them before
everything else this ordering is nearer to IEEE 784 than
standard Float.compare(float, float).static final FloatOrdering STANDARD_ASCENDING
float values.
Please note that this order is broken as it considers
-0.0 < 0.0 which is not correct, for primitive
float values -0.0 == 0.0 is valid.NATURAL_ASCENDINGstatic final FloatOrdering STANDARD_DESCENDING
float values.
Please note that this order is broken as it considers
-0.0 < 0.0 which is not correct, for primitive
float values -0.0 == 0.0 is valid.@NotNull Order checkFloat(float v1, float v2)
v1 - first valuev2 - second valuedefault boolean ascending(float v1,
float v2)
v1 - first valuev2 - second valuetrue if v1 < v2 according to this orderingfalse if v1 >= v2 according to this orderingdescending(float, float),
ascendingOrSame(float, float),
descendingOrSame(float, float),
same(float, float),
different(float, float)default boolean ascendingOrSame(float v1,
float v2)
v1 - first valuev2 - second valuetrue if v1 <= v2 according to this orderingfalse if v1 > v2 according to this orderingascending(float, float),
descending(float, float),
descendingOrSame(float, float),
same(float, float),
different(float, float)default boolean descending(float v1,
float v2)
v1 - first valuev2 - second valuetrue if v1 > v2 according to this orderingfalse if v1 <= v2 according to this orderingascending(float, float),
ascendingOrSame(float, float),
descendingOrSame(float, float),
same(float, float),
different(float, float)default boolean descendingOrSame(float v1,
float v2)
v1 - first valuev2 - second valuetrue if v1 >= v2 according to this orderingfalse if v1 < v2 according to this orderingascending(float, float),
descending(float, float),
ascendingOrSame(float, float),
same(float, float),
different(float, float)default boolean same(float v1,
float v2)
v1 - first valuev2 - second valuetrue if v1 == v2 according to this orderfalse if v1 != v2 according to this orderingascending(float, float),
descending(float, float),
ascendingOrSame(float, float),
descendingOrSame(float, float),
different(float, float)default boolean different(float v1,
float v2)
v1 - first valuev2 - second valuetrue if v1 != v2 according to this orderfalse if v1 == v2 according to this orderingascending(float, float),
descending(float, float),
ascendingOrSame(float, float),
descendingOrSame(float, float),
same(float, float)@NotNull default FloatOrdering inverse()
@NotNull default java.util.Comparator<java.lang.Float> asFloatComparator()
Float@NotNull default java.util.Comparator<java.lang.Number> asNumberComparator()
Number@NotNull default Ordering<java.lang.Float> asFloatOrdering()
@NotNull static FloatOrdering fromComparator(@NotNull java.util.Comparator<java.lang.Float> comparator)
Double into a double ordering.comparator - comparator of Double