dk.netarkivet.common.utils
Class KeyValuePair<K,V>

java.lang.Object
  extended by dk.netarkivet.common.utils.KeyValuePair<K,V>
Type Parameters:
K - the Object type used as key
V - the Object type used as value
All Implemented Interfaces:
java.util.Map.Entry<K,V>

public class KeyValuePair<K,V>
extends java.lang.Object
implements java.util.Map.Entry<K,V>

A generic Map.Entry class, useful for returning key-value-like results.


Constructor Summary
KeyValuePair(K k, V v)
          Constructs a Key-Value pair using the given key and value.
 
Method Summary
 K getKey()
          Returns the key corresponding to this entry.
 V getValue()
          Returns the value corresponding to this entry.
 V setValue(V newValue)
          Replaces the value corresponding to this entry with the specified value (optional operation).
 
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

KeyValuePair

public KeyValuePair(K k,
                    V v)
Constructs a Key-Value pair using the given key and value.

Parameters:
k - The key object
v - The value object
Method Detail

getKey

public K getKey()
Returns the key corresponding to this entry.

Specified by:
getKey in interface java.util.Map.Entry<K,V>
Returns:
the key corresponding to this entry.

getValue

public V getValue()
Returns the value corresponding to this entry.

Specified by:
getValue in interface java.util.Map.Entry<K,V>
Returns:
the value corresponding to this entry.

setValue

public V setValue(V newValue)
           throws java.lang.UnsupportedOperationException
Replaces the value corresponding to this entry with the specified value (optional operation).

Specified by:
setValue in interface java.util.Map.Entry<K,V>
Parameters:
newValue - new value to be stored in this entry.
Returns:
old value corresponding to the entry.
Throws:
java.lang.UnsupportedOperationException - if the put operation is not supported by the backing map.