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