public class PairMapEntry<K,V> extends AbstractMapEntry<K,V>
PairMapEntry is the easiest implementation of a
Map.Entry ever: a pair! Basically saves coders the
drugery of writing an inner class at the expense of an import
statement.
Note that PairMapEntrys are mutable:
setValue(Object) is defined in this class.
Using null as a key or value will not cause this class
or AbstractMapEntry to fail, but be warned that
several Map implementations do not like
nulls in their internal structures.| Constructor and Description |
|---|
PairMapEntry(K key,
V value)
Creates a
PairMapEntry. |
| Modifier and Type | Method and Description |
|---|---|
K |
getKey()
Returns the key corresponding to this entry.
|
V |
getValue()
Returns the value corresponding to this entry.
|
protected K |
setKey(K newKey)
For use in subclass implementations *only*.
|
V |
setValue(V newValue)
Replaces the value corresponding to this entry with the specified
value (optional operation).
|
equals, hashCode, toStringpublic PairMapEntry(K key, V value)
PairMapEntry.public K getKey()
AbstractMapEntrypublic V getValue()
AbstractMapEntryremove() operation), the results of this call are
undefined.public V setValue(V newValue)
AbstractMapEntryremove()
operation).Copyright (c) 2006 C. Scott Ananian