K
- Key type.V
- Value type.public class Pair<K,V> extends Object
Constructor and Description |
---|
Pair(K k,
V v)
Create an entry representing a mapping from the specified key to the
specified value.
|
Pair(Pair<? extends K,? extends V> entry)
Create an entry representing the same mapping as the specified entry.
|
Modifier and Type | Method and Description |
---|---|
static <K,V> Pair<K,V> |
create(K k,
V v)
Convenience factory method that calls the
constructor . |
boolean |
equals(Object o)
Compare the specified object with this entry for equality.
|
K |
getFirst()
Get the first element of the pair.
|
K |
getKey()
Get the key.
|
V |
getSecond()
Get the second element of the pair.
|
V |
getValue()
Get the value.
|
int |
hashCode()
Compute a hash code.
|
String |
toString() |
public Pair(K k, V v)
k
- Key (first element of the pair).v
- Value (second element of the pair).public K getFirst()
public V getSecond()
public int hashCode()
public static <K,V> Pair<K,V> create(K k, V v)
constructor
.K
- the key typeV
- the value typek
- First element of the pair.v
- Second element of the pair.Pair
containing k
and v
.Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.