public final class BytePair extends java.lang.Object implements java.io.Serializable, ByteIndexable
This is similar to Pair
, but for raw byte
values.
As these values are defined final, this class is also immutable.
ByteIndexable.Base
Modifier and Type | Field and Description |
---|---|
byte |
first
The first value of this pair.
|
byte |
second
The second value of this pair.
|
EMPTY, LOWERCASE_2DIGIT_HEXCODES, SINGLE_0, UPPERCASE_2DIGIT_HEXCODES
EMPTY_BYTE_ITERATOR
Constructor and Description |
---|
BytePair(byte first,
byte second)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
applyAsBytes(ByteFunction2<T> function)
Apply a 2-byte function on this pair.
|
boolean |
equals(java.lang.Object o) |
byte |
get(int index)
Get the element at the given index.
|
int |
hashCode() |
byte |
operate(ByteOperator2 operator)
Call an 2-byte operator on this pair.
|
int |
size()
Get the size.
|
BytePair |
swapped()
Get this pair with swapped values.
|
boolean |
test(BytePredicate2 predicate)
Call a 2-byte predicate on this pair.
|
IntPair |
toIntPair()
Convert this pair of
byte s into a pair of int s. |
java.lang.String |
toString() |
Tuple2<java.lang.Byte,java.lang.Byte> |
toTuple()
Convert this into a tuple.
|
IntPair |
toUnsignedIntPair()
Convert this pair of
byte s into a pair of int s assuming unsigned values. |
BytePair |
withFirst(byte first)
Get this pair with a different first value.
|
BytePair |
withSecond(byte second)
Get this pair with a different first value.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAllTo, addToArray, addToArray, addToArray, addToArray, asBase, asCollection, asIndexable, asIntIndexable, asList, asUnsignedIndexable, binarySearch, binarySearch, byteIterator, byteIterator, bytesFromHexString, compare, compareUnsigned, copyTo, copyTo, emptyIndexable, equal, equal, firstMatch, foldLeft, fromHexString, frozen, getMod, gyt, hash, headSet, indexes, init, initByIndex, intIndexes, intIterator, isEmpty, isOrdered, isOrdered, isStrictlyOrdered, isStrictlyOrdered, iterator, lastMatch, listIterator, nextMatch, ordered, previousMatch, reverse, rotated, singleton, subSet, sybSet, tailSet, toArray, toByteArray, toHexString, toHexString, toIntArray, toList, toString, view, viewArray, viewArray, viewArray, viewAsBoolean, viewAsDouble, viewAsFloat, viewAsInt, viewAsLong, viewAsShort, viewAsUnsignedInt, viewAsUnsignedLong, viewAsUnsignedShort, viewByIndex, viewIndexable, viewIndexable, viewIndexable, viewList, viewList, viewList, viewNumberArray, viewOp, withAppendedValue, withCachedHash, withExchangedValueAt, withInsertedValueAt, withRemovedValueAt, withSwappedValuesAt
asIntIterable, asLongIterable, asShortIterable, asUnsignedIntIterable, asUnsignedLongIterable, containsByte, forEachByte, forEachByteFragile
public final byte first
public final byte second
public BytePair(byte first, byte second)
first
- first value of pairsecond
- second value of pair@NotNull public IntPair toIntPair()
byte
s into a pair of int
s.@NotNull public IntPair toUnsignedIntPair()
byte
s into a pair of int
s assuming unsigned values.@NotNull public BytePair withFirst(byte first)
first
- new first valuefirst
value,
and the second
value of this pair@NotNull public BytePair withSecond(byte second)
second
- new second valuefirst
value of this pair,
and the given second
valuepublic int size()
Sizeable
public byte get(int index)
ByteIndexable
get
in interface ByteIndexable
index
- index between 0
and size() - 1
public <T> T applyAsBytes(@NotNull ByteFunction2<T> function)
public byte operate(@NotNull ByteOperator2 operator)
public boolean test(@NotNull BytePredicate2 predicate)
@NotNull public Tuple2<java.lang.Byte,java.lang.Byte> toTuple()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
@NotNull public java.lang.String toString()
toString
in class java.lang.Object