K - the key-type of the pair.V - the value-type of the pair.@GwtCompatible
public final class Pair<K,V>
extends java.lang.Object
implements java.io.Serializable
key and value. A pair is considered to be
equal to another pair if both the key and the value are equal.| Constructor and Description |
|---|
Pair(K k,
V v)
Creates a new instance with the given key and value.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
K |
getKey()
Returns the key.
|
V |
getValue()
Returns the value.
|
int |
hashCode() |
static <K,V> Pair<K,V> |
of(K k,
V v)
Creates a new instance with the given key and value.
|
java.lang.String |
toString() |
@Pure public static <K,V> Pair<K,V> of(K k, V v)
k - the key. May be null.v - the value. May be null.null.public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object