public final class Pair<A,B> extends Object implements Serializable
| Constructor and Description |
|---|
Pair(A left,
B right)
Constructor for Pair.
|
| Modifier and Type | Method and Description |
|---|---|
static <A,B> Pair<B,B> |
ap(Pair<A,A> aa,
Pair<Function<A,B>,Function<A,B>> ff)
Performs function application within an homogeneous pair (applicative
functor pattern).
|
boolean |
equals(Object o) |
int |
hashCode() |
A |
left()
Accessor method for the left value of the pair.
|
static <A> Function<Pair<A,?>,A> |
leftValue()
Function for accessing the left value of
pairs. |
static <A,B> Pair<B,B> |
map(Pair<A,A> aa,
Function<A,B> f)
Apply a function to both elements of an homogeneous pair.
|
static <A,B> Pair<A,B> |
pair(A left,
B right)
Factory method for static Pair growth.
|
static <A,B> BiFunction<A,B,Pair<A,B>> |
pairs()
Factory method for a Pair factory function.
|
B |
right()
Accessor method for the right value of the pair.q
|
static <B> Function<Pair<?,B>,B> |
rightValue()
Function for accessing the right value of
pairs. |
String |
toString() |
static <A,B> Iterable<Pair<A,B>> |
zip(Iterable<A> as,
Iterable<B> bs)
Zips two iterables into a single iterable that produces
pairs. |
public static <A,B> Pair<A,B> pair(A left, B right)
A - the left value typeB - the right value typeleft - value, cannot be nullright - value, cannot be nullpublic static <A,B> BiFunction<A,B,Pair<A,B>> pairs()
A - the left value typeB - the right value typepublic static <A> Function<Pair<A,?>,A> leftValue()
pairs.A - the left value typePair returns the
left side valuepublic static <B> Function<Pair<?,B>,B> rightValue()
pairs.B - the right value typePair returns the
right side valuepublic static <A,B> Pair<B,B> ap(Pair<A,A> aa, Pair<Function<A,B>,Function<A,B>> ff)
aa - an homogeneous pairff - The pair of functions to apply.public static <A,B> Pair<B,B> map(Pair<A,A> aa, Function<A,B> f)
aa - an homogeneous pairf - function to apply to both elements of aapublic static <A,B> Iterable<Pair<A,B>> zip(Iterable<A> as, Iterable<B> bs)
pairs.A - LHS typeB - RHS typeas - left valuesbs - right valuesiterable of pairs, only as long as the shortest
input iterable.public A left()
public B right()
Copyright © 2017 Atlassian. All rights reserved.