Pair

public final class Pair<A extends Message, B> extends Tuple implements Element.AValue<T>, Element.BValue<T>

A tuple with two elements.

The first element must be a non-default Message and not Empty.

The second element can be Message, Optional or Either.

Parameters

<A>

the type of the first element

<B>

the type of the second element

Functions

Link copied to clipboard
public A getA()
Obtains the first element of the tuple.
Link copied to clipboard
public B getB()
Obtains the second element of the tuple.
Link copied to clipboard
public static Pair<A, B> of<A extends Message, B extends Message>(A a, B b)
Creates a new pair of values.
Link copied to clipboard
public static Pair<A, B> withEither<A extends Message, B extends Either>(A a, B b)
Creates a pair with the second element of a type descending from Either.
Link copied to clipboard
public static Pair<A, Optional<B>> withNullable<A extends Message, B extends Message>(A a, B b)
Creates a pair with optionally present second value.
Link copied to clipboard
public static Pair<A, Optional<B>> withOptional<A extends Message, B extends Message>(A a, Optional<B> b)
Creates a pair with optionally present second value.

Inherited functions

Link copied to clipboard
public final boolean equals(Object obj)
Link copied to clipboard
public void forEach(Consumer<? extends Object> action)
Link copied to clipboard
protected final Object get(int index)
Obtains a value at the specified index.
Link copied to clipboard
public final int hashCode()
Link copied to clipboard
public final Iterator<Message> iterator()
public abstract Iterator<T> iterator()
Link copied to clipboard