|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.template.soy.internal.base.Pair<A,B>
public class Pair<A,B>
An immutable, semantic-free ordered pair of nullable values. These can be
accessed using the getFirst() and getSecond() methods. 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.labs.misc.ComparisonKeys or com.google.common.labs.misc.ValueType to help you with this instead.
| Field Summary | |
|---|---|
A |
first
The first element of the pair; see also getFirst(). |
B |
second
The second element of the pair; see also getSecond(). |
| Constructor Summary | |
|---|---|
Pair(A first,
B second)
Constructor. |
|
| Method Summary | ||
|---|---|---|
boolean |
equals(Object object)
|
|
A |
getFirst()
Returns the first element of this pair; see also first. |
|
B |
getSecond()
Returns the second element of this pair; see also second. |
|
int |
hashCode()
|
|
static
|
of(A first,
B second)
Creates a new pair containing the given elements in order. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final A first
getFirst().
public final B second
getSecond().
| Constructor Detail |
|---|
public Pair(@Nullable
A first,
@Nullable
B second)
of(A, B).
| Method Detail |
|---|
public static <A,B> Pair<A,B> of(@Nullable
A first,
@Nullable
B second)
public A getFirst()
first.
public B getSecond()
second.
public boolean equals(@Nullable
Object object)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic 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.
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||