public final class ShortPair extends java.lang.Object implements java.io.Serializable, ShortIndexable
This is similar to Pair
, but for raw short
values.
As these values are defined final, this class is also immutable.
ShortIndexable.Base
Modifier and Type | Field and Description |
---|---|
short |
first
The first value of this pair.
|
short |
second
The second value of this pair.
|
EMPTY, SINGLE_0
EMPTY_SHORT_ITERATOR
Constructor and Description |
---|
ShortPair(short first,
short second)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
applyAsShorts(ShortFunction2<T> function)
Apply a 2-short function on this pair.
|
boolean |
equals(java.lang.Object o) |
short |
get(int index)
Get the element at the given index.
|
int |
hashCode() |
short |
operate(ShortOperator2 operator)
Call an 2-short operator on this pair.
|
int |
size()
Get the size.
|
ShortPair |
swapped()
Get this pair with swapped values.
|
boolean |
test(ShortPredicate2 predicate)
Call a 2-short predicate on this pair.
|
IntPair |
toIntPair()
Convert this pair of
short s into a pair of int s. |
java.lang.String |
toString() |
Tuple2<java.lang.Short,java.lang.Short> |
toTuple()
Convert this into a tuple.
|
IntPair |
toUnsignedIntPair()
Convert this pair of
short s into a pair of int s assuming unsigned values. |
ShortPair |
withFirst(short first)
Get this pair with a different first value.
|
ShortPair |
withSecond(short 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, compare, compareUnsigned, emptyIndexable, equal, equal, firstMatch, foldLeft, frozen, getMod, gyt, hash, headSet, indexes, init, initByIndex, intIndexes, intIterator, isEmpty, isOrdered, isOrdered, isStrictlyOrdered, isStrictlyOrdered, iterator, lastMatch, listIterator, nextMatch, ordered, ordered, previousMatch, reverse, rotated, shortIterator, shortIterator, singleton, subSet, sybSet, tailSet, toArray, toIntArray, toList, toString, view, viewArray, viewArray, viewArray, viewAsBoolean, viewAsByte, viewAsDouble, viewAsFloat, viewAsInt, viewAsLong, viewAsUnsignedInt, viewAsUnsignedLong, viewByIndex, viewIndexable, viewIndexable, viewIndexable, viewList, viewList, viewList, viewNumberArray, viewOp, withAppendedValue, withCachedHash, withExchangedValueAt, withInsertedValueAt, withRemovedValueAt, withSwappedValuesAt
asIntIterable, asLongIterable, asUnsignedIntIterable, asUnsignedLongIterable, containsShort, forEachShort, forEachShortFragile
public final short first
public final short second
public ShortPair(short first, short second)
first
- first value of pairsecond
- second value of pair@NotNull public IntPair toIntPair()
short
s into a pair of int
s.@NotNull public IntPair toUnsignedIntPair()
short
s into a pair of int
s assuming unsigned values.@NotNull public ShortPair withFirst(short first)
first
- new first valuefirst
value,
and the second
value of this pair@NotNull public ShortPair withSecond(short second)
second
- new second valuefirst
value of this pair,
and the given second
valuepublic int size()
Sizeable
public short get(int index)
ShortIndexable
get
in interface ShortIndexable
index
- index between 0
and size() - 1
public <T> T applyAsShorts(@NotNull ShortFunction2<T> function)
public short operate(@NotNull ShortOperator2 operator)
public boolean test(@NotNull ShortPredicate2 predicate)
@NotNull public Tuple2<java.lang.Short,java.lang.Short> 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