de.espirit.common.util
Class Pair<K,V>

java.lang.Object
  extended by de.espirit.common.util.Pair<K,V>
All Implemented Interfaces:
Serializable, Map.Entry<K,V>

public class Pair<K,V>
extends Object
implements Serializable, Map.Entry<K,V>

Container for a pair of objects, usually a key and a value.

Since:
4.2.34
See Also:
Serialized Form

Constructor Summary
Pair(K key, V value)
          Use the factory method Pair.create(Object, Object).
 
Method Summary
static
<K,V> Pair<K,V>
create(K key, V value)
          Create a pair with the given key and value.
 K getKey()
          The key of the pair.
 V getValue()
          Returns the value corresponding to this pair.
 void setKey(K key)
          Set the key of the pair, null keys are allowed.
 V setValue(V value)
          Set the value of the pair, null values are allowed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map.Entry
equals, hashCode
 

Constructor Detail

Pair

public Pair(K key,
            V value)
Use the factory method Pair.create(Object, Object).

Since:
4.2.34
Method Detail

create

public static <K,V> Pair<K,V> create(K key,
                                     V value)
Create a pair with the given key and value.

Parameters:
key - key of the pair
value - value of the pair
Since:
4.2.34

getKey

public K getKey()
The key of the pair.

Specified by:
getKey in interface Map.Entry<K,V>
Since:
4.2.34

setKey

public void setKey(K key)
Set the key of the pair, null keys are allowed.

Since:
4.2.34

getValue

public V getValue()
Returns the value corresponding to this pair. The value may be null.

Specified by:
getValue in interface Map.Entry<K,V>
Returns:
Returns the value corresponding to this pair.
Since:
4.2.34

setValue

public V setValue(V value)
Set the value of the pair, null values are allowed.

Specified by:
setValue in interface Map.Entry<K,V>
Since:
4.2.34


Copyright © 2012 e-Spirit AG. All Rights Reserved. Build 4.2.480