@FunctionalInterface
public interface LongOrdering
Compared to a Comparator<Long>
this can
avoid boxing and unboxing in various situations.
For this use the checkLong(long, long)
method,
the check(Long, Long)
method is only for situations
where this is used as a generic ordering (which requires boxing
and unboxing).
Modifier and Type | Interface and Description |
---|---|
static interface |
LongOrdering.Serial
A long ordering which is serializable.
|
Modifier and Type | Field and Description |
---|---|
static LongOrdering |
ASCENDING
Natural order of ascending
long values. |
static LongOrdering |
DESCENDING
Inverse natural order of
long values. |
static LongOrdering |
UNSIGNED_ASCENDING
Natural order of ascending unsigned
long values. |
static LongOrdering |
UNSIGNED_DESCENDING
Natural order of ascending unsigned
long values. |
Modifier and Type | Method and Description |
---|---|
default boolean |
ascending(long v1,
long v2)
Are the two values represented in strictly ascending order?
|
default boolean |
ascendingOrSame(long v1,
long v2)
Are the two values represented in ascending order?
|
default java.util.Comparator<java.lang.Long> |
asLongComparator()
Use this ordering as a comparator.
|
default Ordering<java.lang.Long> |
asLongOrdering()
Get this ordering as a generic long ordering.
|
default java.util.Comparator<java.lang.Number> |
asNumberComparator()
View this ordering as a number comparator.
|
default Order |
check(java.lang.Long v1,
java.lang.Long v2) |
Order |
checkLong(long v1,
long v2)
Get the order of the two values.
|
default boolean |
descending(long v1,
long v2)
Are the two values represented in strictly descending order?
|
default boolean |
descendingOrSame(long v1,
long v2)
Are the two values represented in descending order?
|
default boolean |
different(long v1,
long v2)
Are the two values considered different by this order?
|
static LongOrdering |
fromComparator(java.util.Comparator<java.lang.Long> comparator)
Convert a standard comparator of
Double into a double ordering. |
default LongOrdering |
inverse()
Invert this order.
|
default boolean |
same(long v1,
long v2)
Are the two values considered equal by this order?
|
static final LongOrdering ASCENDING
long
values.static final LongOrdering DESCENDING
long
values.static final LongOrdering UNSIGNED_ASCENDING
long
values.
This handles long values as if they are unsigned and not signed.static final LongOrdering UNSIGNED_DESCENDING
long
values.
This handles long values as if they are unsigned and not signed.@NotNull Order checkLong(long v1, long v2)
v1
- first valuev2
- second valuedefault boolean ascending(long v1, long v2)
v1
- first valuev2
- second valuetrue
if v1 < v2
according to this orderingfalse
if v1 >= v2
according to this orderingdescending(long, long)
,
ascendingOrSame(long, long)
,
descendingOrSame(long, long)
,
same(long, long)
,
different(long, long)
default boolean ascendingOrSame(long v1, long v2)
v1
- first valuev2
- second valuetrue
if v1 <= v2
according to this orderingfalse
if v1 > v2
according to this orderingascending(long, long)
,
descending(long, long)
,
descendingOrSame(long, long)
,
same(long, long)
,
different(long, long)
default boolean descending(long v1, long v2)
v1
- first valuev2
- second valuetrue
if v1 > v2
according to this orderingfalse
if v1 <= v2
according to this orderingascending(long, long)
,
ascendingOrSame(long, long)
,
descendingOrSame(long, long)
,
same(long, long)
,
different(long, long)
default boolean descendingOrSame(long v1, long v2)
v1
- first valuev2
- second valuetrue
if v1 >= v2
according to this orderingfalse
if v1 < v2
according to this orderingascending(long, long)
,
descending(long, long)
,
ascendingOrSame(long, long)
,
same(long, long)
,
different(long, long)
default boolean same(long v1, long v2)
v1
- first valuev2
- second valuetrue
if v1 == v2
according to this orderfalse
if v1 != v2
according to this orderingascending(long, long)
,
descending(long, long)
,
ascendingOrSame(long, long)
,
descendingOrSame(long, long)
,
different(long, long)
default boolean different(long v1, long v2)
v1
- first valuev2
- second valuetrue
if v1 != v2
according to this orderfalse
if v1 == v2
according to this orderingascending(long, long)
,
descending(long, long)
,
ascendingOrSame(long, long)
,
descendingOrSame(long, long)
,
same(long, long)
@NotNull default LongOrdering inverse()
@NotNull default java.util.Comparator<java.lang.Long> asLongComparator()
Long
@NotNull default java.util.Comparator<java.lang.Number> asNumberComparator()
Number
@NotNull default Ordering<java.lang.Long> asLongOrdering()
@NotNull static LongOrdering fromComparator(@NotNull java.util.Comparator<java.lang.Long> comparator)
Double
into a double ordering.comparator
- comparator of Double