public final class IntPair extends java.lang.Object implements java.io.Serializable, IntIndexable
This is similar to Pair
, but for raw int
values.
As these values are defined final, this class is also immutable.
IntIndexable.Base, IntIndexable.EntryConsumer, IntIndexable.IntIndexableSpliterator
Modifier and Type | Field and Description |
---|---|
int |
first
The first value of this pair.
|
int |
second
The second value of this pair.
|
EMPTY, SINGLE_0
EMPTY_INT_ITERATOR
Constructor and Description |
---|
IntPair(int first,
int second)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
applyAsInts(IntFunction2<T> function)
Apply a 2-int function on this pair.
|
boolean |
equals(java.lang.Object o) |
int |
get(int index)
Get the element at the given index.
|
int |
hashCode() |
int |
operate(IntOperator2 operator)
Call an 2-int operator on this pair.
|
int |
size()
Get the size.
|
IntPair |
swapped()
Get this pair with swapped values.
|
boolean |
test(IntPredicate2 predicate)
Call a 2-int predicate on this pair.
|
LongPair |
toLongPair()
Convert this pair of
int s into a pair of long s. |
java.lang.String |
toString() |
Tuple2<java.lang.Integer,java.lang.Integer> |
toTuple()
Convert this into a tuple.
|
LongPair |
toUnsignedLongPair()
Convert this pair of
int s into a pair of long s assuming unsigned values. |
IntPair |
withFirst(int first)
Get this pair with a different first value.
|
IntPair |
withSecond(int second)
Get this pair with a different first value.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAllTo, addToArray, addToArray, asBase, asCollection, asIndexable, asList, asLongIndexable, asUnsignedIndexable, binarySearch, binarySearch, compare, compareUnsigned, emptyIndexable, equal, equal, firstMatch, foldLeft, forEachIntEntry, frozen, frozenIntSpliterator, getMod, gyt, hash, headSet, indexes, init, initByIndex, intIndexes, intIterator, intIterator, intSpliterator, isEmpty, isOrdered, isStrictlyOrdered, iterator, lastMatch, listIterator, nextMatch, ordered, ordered, previousMatch, range, range, rangeFromSize, reverse, rotated, singleton, subSet, sybSet, tailSet, toArray, toList, toString, view, viewArray, viewArray, viewArray, viewAsBoolean, viewAsByte, viewAsChar, viewAsDouble, viewAsDouble, viewAsFloat, viewAsLong, viewAsLong, viewAsShort, viewAsUnsignedLong, viewByIndex, viewIndexable, viewIndexable, viewIndexable, viewList, viewList, viewList, viewNumberArray, viewOp, with, withAppendedValue, withCachedHash, withExchangedValueAt, withInsertedValueAt, withRemovedValueAt, withSwappedValuesAt, wyth
empty, filtered, first, isEqual, isSorted, isStrictlySorted, last, sorted, toString, uniform, viewCollection, viewCollection, viewCollectionN, viewCollectionN
average, containsInt, forEachInt, forEachIntFragile, longSum, longSumX, spliterator, stream, sum, sumX
public final int first
public final int second
public IntPair(int first, int second)
first
- first value of pairsecond
- second value of pair@NotNull public LongPair toLongPair()
int
s into a pair of long
s.@NotNull public LongPair toUnsignedLongPair()
int
s into a pair of long
s assuming unsigned values.@NotNull public IntPair withFirst(int first)
first
- new first valuefirst
value,
and the second
value of this pair@NotNull public IntPair withSecond(int second)
second
- new second valuefirst
value of this pair,
and the given second
valuepublic int size()
Sizeable
public int get(int index)
IntIndexable
get
in interface IntIndexable
index
- index between 0
and size() - 1
public <T> T applyAsInts(@NotNull IntFunction2<T> function)
public int operate(@NotNull IntOperator2 operator)
public boolean test(@NotNull IntPredicate2 predicate)
@NotNull public Tuple2<java.lang.Integer,java.lang.Integer> 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