public final class LongPair extends java.lang.Object implements java.io.Serializable, LongIndexable
This is similar to Pair, but for raw long values.
As these values are defined final, this class is also immutable.
LongIndexable.Base, LongIndexable.LongIndexableSpliterator| Modifier and Type | Field and Description |
|---|---|
long |
first
The first value of this pair.
|
long |
second
The second value of this pair.
|
EMPTYEMPTY_LONG_ITERATOR| Constructor and Description |
|---|
LongPair(long first,
long second)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
applyAsLongs(LongFunction2<T> function)
Apply a 2-long function on this pair.
|
boolean |
equals(java.lang.Object o) |
long |
get(int index)
Get the element at the given index.
|
int |
hashCode() |
long |
operate(LongOperator2 operator)
Call an 2-long operator on this pair.
|
int |
size()
Get the size.
|
LongPair |
swapped()
Get this pair with swapped values.
|
boolean |
test(LongPredicate2 predicate)
Call a 2-long predicate on this pair.
|
java.lang.String |
toString() |
Tuple2<java.lang.Long,java.lang.Long> |
toTuple()
Convert this into a tuple.
|
LongPair |
withFirst(long first)
Get this pair with a different first value.
|
LongPair |
withSecond(long second)
Get this pair with a different first value.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAllTo, addToArray, addToArray, asBase, asCollection, asIndexable, asList, binarySearch, binarySearch, compare, compareUnsigned, emptyIndexable, equal, equal, firstMatch, foldLeft, frozen, frozenLongSpliterator, getMod, gyt, hash, headSet, indexes, init, initByIndex, intIndexes, isEmpty, isOrdered, isStrictlyOrdered, iterator, lastMatch, listIterator, longIterator, longIterator, longSpliterator, nextMatch, ordered, ordered, previousMatch, reverse, rotated, singleton, subSet, sybSet, tailSet, toArray, toList, toString, view, viewArray, viewArray, viewArray, viewAsBoolean, viewAsByte, viewAsDouble, viewAsDouble, viewAsFloat, viewAsInt, viewAsInt, viewAsShort, viewByIndex, viewIndexable, viewIndexable, viewIndexable, viewList, viewList, viewList, viewNumberArray, viewOp, withAppendedValue, withCachedHash, withExchangedValueAt, withInsertedValueAt, withRemovedValueAt, withSwappedValuesAtaverage, containsLong, forEachLong, forEachLongFragile, spliterator, stream, sum, sumXpublic final long first
public final long second
public LongPair(long first,
long second)
first - first value of pairsecond - second value of pair@NotNull public LongPair withFirst(long first)
first - new first valuefirst value,
and the second value of this pair@NotNull public LongPair withSecond(long second)
second - new second valuefirst value of this pair,
and the given second valuepublic int size()
Sizeablepublic long get(int index)
LongIndexableget in interface LongIndexableindex - index between 0 and size() - 1public <T> T applyAsLongs(@NotNull LongFunction2<T> function)
public long operate(@NotNull LongOperator2 operator)
public boolean test(@NotNull LongPredicate2 predicate)
@NotNull public Tuple2<java.lang.Long,java.lang.Long> 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