A
- the type of the first elementB
- the type of the second elementpublic final class Pair<A extends com.google.protobuf.Message,B> extends Tuple
The first element must be a non-default Message
and not Empty
.
The second element can be Message
, Optional
or
Either
.
Modifier and Type | Method and Description |
---|---|
A |
getA()
Obtains the first element of the tuple.
|
B |
getB()
Obtains the second element of the tuple.
|
static <A extends com.google.protobuf.Message,B extends com.google.protobuf.Message> |
of(A a,
B b)
Creates a new pair of values.
|
static <A extends com.google.protobuf.Message,B extends Either> |
withEither(A a,
B b)
Creates a pair with the second element of a type descending from
Either . |
static <A extends com.google.protobuf.Message,B extends com.google.protobuf.Message> |
withNullable(A a,
B b)
Creates a pair with optionally present second value.
|
static <A extends com.google.protobuf.Message,B extends com.google.protobuf.Message> |
withOptional(A a,
java.util.Optional<B> b)
Creates a pair with optionally present second value.
|
public static <A extends com.google.protobuf.Message,B extends com.google.protobuf.Message> Pair<A,B> of(A a, B b)
public static <A extends com.google.protobuf.Message,B extends com.google.protobuf.Message> Pair<A,java.util.Optional<B>> withNullable(A a, B b)
Pair.withOptional(Message, Optional)
public static <A extends com.google.protobuf.Message,B extends com.google.protobuf.Message> Pair<A,java.util.Optional<B>> withOptional(A a, java.util.Optional<B> b)
Pair.withNullable(Message, Message)
Optional
. This avoids unwrapping of Optional
which would
have been required for passing an optional value to
Pair.withNullable(Message, Message)
.public static <A extends com.google.protobuf.Message,B extends Either> Pair<A,B> withEither(A a, B b)
Either
.public A getA()
public B getB()