public final class DoublePair extends java.lang.Object implements java.io.Serializable, DoubleIndexable
This is similar to Pair
, but for raw double
values.
As these values are defined final, this class is also immutable.
DoubleIndexable.Base, DoubleIndexable.DoubleIndexableSpliterator
Modifier and Type | Field and Description |
---|---|
double |
first
The first value of this pair.
|
double |
second
The second value of this pair.
|
EMPTY, SINGLE_0
EMPTY_DOUBLE_ITERATOR
Constructor and Description |
---|
DoublePair(double first,
double second)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
applyAsDoubles(DoubleFunction2<T> function)
Apply a 2-double function on this pair.
|
boolean |
equals(java.lang.Object o) |
double |
get(int index)
Get the element at the given index.
|
int |
hashCode() |
double |
operate(DoubleOperator2 operator)
Call an 2-double operator on this pair.
|
int |
size()
Get the size.
|
DoublePair |
swapped()
Get this pair with swapped values.
|
boolean |
test(DoublePredicate2 predicate)
Call a 2-double predicate on this pair.
|
java.lang.String |
toString() |
Tuple2<java.lang.Double,java.lang.Double> |
toTuple()
Convert this into a tuple.
|
DoublePair |
withFirst(double first)
Get this pair with a different first value.
|
DoublePair |
withSecond(double second)
Get this pair with a different first value.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAllTo, addToArray, addToArray, asBase, asCollection, asIndexable, asList, binarySearch, binarySearch, compare, deltas, doubleIterator, doubleIterator, doubleSpliterator, emptyIndexable, equal, equal, equal, equalStandard, firstMatch, firstValue, foldLeft, frozen, frozenDoubleSpliterator, getMod, gyt, hash, headSet, indexes, init, initByIndex, intIndexes, isEmpty, isOrdered, isStrictlyOrdered, iterator, lastMatch, lastValue, listIterator, nextMatch, ordered, ordered, previousMatch, reverse, rotated, singleton, subSet, sybSet, tailSet, toArray, toList, toString, transformed, view, viewArray, viewArray, viewArray, viewArray, viewAsBoolean, viewAsByte, viewAsFloat, viewAsInt, viewAsInt, viewAsLong, viewAsLong, viewAsShort, viewByIndex, viewIndexable, viewIndexable, viewIndexable, viewList, viewList, viewList, viewNumberArray, viewOp, withAppendedValue, withCachedHash, withExchangedValueAt, withInsertedValueAt, withRemovedValueAt, withSwappedValuesAt
average, containsDouble, containsDouble, forEachDouble, forEachDoubleFragile, spliterator, stream, sum
public final double first
public final double second
public DoublePair(double first, double second)
first
- first value of pairsecond
- second value of pair@NotNull public DoublePair withFirst(double first)
first
- new first valuefirst
value,
and the second
value of this pair@NotNull public DoublePair withSecond(double second)
second
- new second valuefirst
value of this pair,
and the given second
value@NotNull public DoublePair swapped()
public int size()
Sizeable
public double get(int index)
DoubleIndexable
get
in interface DoubleIndexable
index
- index between 0
and size() - 1
public <T> T applyAsDoubles(@NotNull DoubleFunction2<T> function)
public double operate(@NotNull DoubleOperator2 operator)
public boolean test(@NotNull DoublePredicate2 predicate)
@NotNull public Tuple2<java.lang.Double,java.lang.Double> 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