Class AbstractKeyValue<K,V>
- java.lang.Object
-
- org.apache.commons.collections4.keyvalue.AbstractKeyValue<K,V>
-
- Type Parameters:
K- the type of keysV- the type of values
- All Implemented Interfaces:
KeyValue<K,V>
- Direct Known Subclasses:
AbstractMapEntry,DefaultKeyValue
public abstract class AbstractKeyValue<K,V> extends java.lang.Object implements KeyValue<K,V>
Abstract pair class to assist with creatingKeyValueandMap.Entryimplementations.- Since:
- 3.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractKeyValue(K key, V value)Constructs a new pair with the specified key and given value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KgetKey()Gets the key from the pair.VgetValue()Gets the value from the pair.protected KsetKey(K key)Sets the key.protected VsetValue(V value)Sets the value.java.lang.StringtoString()Gets a debugging String view of the pair.
-
-
-
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 nullvalue- the value for the entry, may be null
-
-
Method Detail
-
setKey
protected K setKey(K key)
Sets the key.- Parameters:
key- The key.- Returns:
- The previous key.
-
setValue
protected V setValue(V value)
Sets the value.- Parameters:
value- The value.- Returns:
- The previous value.
-
toString
public java.lang.String toString()
Gets a debugging String view of the pair.- Overrides:
toStringin classjava.lang.Object- Returns:
- a String view of the entry
-
-