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_0EMPTY_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
shorts into a pair of ints. |
java.lang.String |
toString() |
Tuple2<java.lang.Short,java.lang.Short> |
toTuple()
Convert this into a tuple.
|
IntPair |
toUnsignedIntPair()
Convert this pair of
shorts into a pair of ints 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, waitaddAllTo, 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, withSwappedValuesAtasIntIterable, asLongIterable, asUnsignedIntIterable, asUnsignedLongIterable, containsShort, forEachShort, forEachShortFragilepublic 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()
shorts into a pair of ints.@NotNull public IntPair toUnsignedIntPair()
shorts into a pair of ints 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()
Sizeablepublic short get(int index)
ShortIndexableget in interface ShortIndexableindex - index between 0 and size() - 1public <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.Objectpublic int hashCode()
hashCode in class java.lang.Object@NotNull public java.lang.String toString()
toString in class java.lang.Object