public final class Pair<A,B> extends Object
first and second fields. Equality
and hashing are defined in the natural way.
This type is devoid of semantics, best used for simple mechanical aggregations of unrelated values in implementation code. Avoid using it in your APIs, preferring an explicit type that conveys the exact semantics of the data. For example, instead of:
Pair
to accomplish this; consider using the utilities com.google.common.auto.AutoValue
to help you with this instead.| Modifier and Type | Field and Description |
|---|---|
A |
first
The first element of the pair.
|
B |
second
The second element of the pair.
|
public final A first
public final B second
public static <A,B> Pair<A,B> of(@Nullable A first, @Nullable B second)
public String toString()
This implementation returns a string in the form
(first, second), where first and second are the
String representations of the first and second elements of this pair, as
given by String.valueOf(Object). Subclasses are free to override
this behavior.