org.apache.commons.collections.keyvalue
Class AbstractKeyValue<K,V>

java.lang.Object
  extended by org.apache.commons.collections.keyvalue.AbstractKeyValue<K,V>
All Implemented Interfaces:
KeyValue<K,V>
Direct Known Subclasses:
AbstractMapEntry, DefaultKeyValue

public abstract class AbstractKeyValue<K,V>
extends Object
implements KeyValue<K,V>

Abstract pair class to assist with creating KeyValue and MapEntry implementations.

Since:
Commons Collections 3.0
Version:
$Revision: 1.1.1.1 $ $Date: 2005/05/23 04:35:06 $
Author:
James Strachan, Michael A. Smith, Neil O'Toole, Matt Hall, John Watkinson, Stephen Colebourne

Field Summary
protected  K key
          The key
protected  V value
          The value
 
Constructor Summary
protected AbstractKeyValue(K key, V value)
          Constructs a new pair with the specified key and given value.
 
Method Summary
 K getKey()
          Gets the key from the pair.
 V getValue()
          Gets the value from the pair.
 String toString()
          Gets a debugging String view of the pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

key

protected K key
The key


value

protected V value
The value

Constructor Detail

AbstractKeyValue

protected AbstractKeyValue(K key,
                           V value)
Constructs a new pair with the specified key and given value.

Parameters:
key - the key for the entry, may be null
value - the value for the entry, may be null
Method Detail

getKey

public K getKey()
Gets the key from the pair.

Specified by:
getKey in interface KeyValue<K,V>
Returns:
the key

getValue

public V getValue()
Gets the value from the pair.

Specified by:
getValue in interface KeyValue<K,V>
Returns:
the value

toString

public String toString()
Gets a debugging String view of the pair.

Overrides:
toString in class Object
Returns:
a String view of the entry


Copyright © 2005-2005 Apache Software Foundation, Matt Hall, John Watkinson. All Rights Reserved.