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

java.lang.Object
  extended by dk.netarkivet.common.utils.KeyValuePair<K,V>
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.


Field Summary
(package private)  K key
           
(package private)  V value
           
 
Constructor Summary
KeyValuePair(K k, V v)
           
 
Method Summary
 K getKey()
          Returns the key corresponding to this entry.
 V getValue()
          Returns the value corresponding to this entry.
 V setValue(V value)
          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
 

Field Detail

key

final K key

value

final V value
Constructor Detail

KeyValuePair

public KeyValuePair(K k,
                    V v)
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 value)
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:
value - 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.