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