L
- R
- public final class Pair<L,R>
extends java.lang.Object
implements java.util.Map.Entry<L,R>
Constructor and Description |
---|
Pair() |
Modifier and Type | Method and Description |
---|---|
void |
accept(BiConsumer<? super L,? super R> action) |
void |
accept(Consumer<Pair<L,R>> action) |
Pair<L,R> |
copy() |
boolean |
equals(java.lang.Object obj) |
Optional<Pair<L,R>> |
filter(BiPredicate<? super L,? super R> predicate) |
Optional<Pair<L,R>> |
filter(Predicate<Pair<L,R>> predicate) |
void |
forEach(Consumer<?> comsumer) |
static <T> Pair<T,T> |
from(java.util.Collection<? extends T> c) |
static <T> Pair<T,T> |
from(T[] a) |
L |
getAndSetLeft(L newLeft) |
R |
getAndSetRight(R newRight) |
L |
getKey() |
L |
getLeft() |
R |
getRight() |
R |
getValue() |
int |
hashCode() |
L |
left() |
<U> U |
map(BiFunction<? super L,? super R,U> mapper) |
<U> U |
map(Function<Pair<L,R>,U> mapper) |
static <L,R> Pair<L,R> |
of(L l,
R r) |
Pair<R,L> |
reversed() |
R |
right() |
Pair<L,R> |
set(L left,
R right) |
L |
setAndGetLeft(L newLeft) |
R |
setAndGetRight(R newRight) |
boolean |
setIf(L newLeft,
R newRight,
TriPredicate<? super Pair<L,R>,? super L,? super R> predicate)
Set to the specified
newLeft and newRight and returns true
if predicate returns true. |
Pair<L,R> |
setLeft(L left) |
boolean |
setLeftIf(L newLeft,
BiPredicate<? super Pair<L,R>,? super L> predicate)
Set to the specified
newLeft and returns true
if predicate returns true. |
Pair<L,R> |
setRight(R right) |
boolean |
setRightIf(R newRight,
BiPredicate<? super Pair<L,R>,? super R> predicate)
Set to the specified
newRight and returns true
if predicate returns true. |
R |
setValue(R value) |
Stream<Pair<L,R>> |
stream() |
java.lang.Object[] |
toArray() |
<A> A[] |
toArray(A[] a) |
java.lang.String |
toString() |
Tuple.Tuple2<L,R> |
toTuple() |
public static <L,R> Pair<L,R> of(L l, R r)
public static <T> Pair<T,T> from(T[] a)
public static <T> Pair<T,T> from(java.util.Collection<? extends T> c)
public L left()
public R right()
public L getLeft()
public R getRight()
public boolean setLeftIf(L newLeft, BiPredicate<? super Pair<L,R>,? super L> predicate)
newLeft
and returns true
if predicate
returns true. Otherwise returns
false
without setting the value to new value.newLeft
- predicate
- - the first parameter is current pair, the second
parameter is the newLeft
public boolean setRightIf(R newRight, BiPredicate<? super Pair<L,R>,? super R> predicate)
newRight
and returns true
if predicate
returns true. Otherwise returns
false
without setting the value to new value.newRight
- predicate
- - the first parameter is current pair, the second
parameter is the newRight
public boolean setIf(L newLeft, R newRight, TriPredicate<? super Pair<L,R>,? super L,? super R> predicate)
newLeft
and newRight
and returns true
if predicate
returns true. Otherwise returns
false
without setting the left/right to new values.newLeft
- newRight
- predicate
- - the first parameter is current pair, the second
parameter is the newLeft
, the third parameter is the newRight
.public java.lang.Object[] toArray()
public <A> A[] toArray(A[] a)
public void forEach(Consumer<?> comsumer)
public void accept(BiConsumer<? super L,? super R> action)
public <U> U map(BiFunction<? super L,? super R,U> mapper)
public Tuple.Tuple2<L,R> toTuple()
public int hashCode()
public boolean equals(java.lang.Object obj)
public java.lang.String toString()
toString
in class java.lang.Object