|
JUtil | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.cscott.jutil.AbstractMapEntry<K,V>
net.cscott.jutil.PairMapEntry<K,V>
public class PairMapEntry<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 PairMapEntry
s 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
null
s in their internal structures.
Constructor Summary | |
---|---|
PairMapEntry(K key,
V value)
Creates a PairMapEntry . |
Method Summary | |
---|---|
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). |
Methods inherited from class net.cscott.jutil.AbstractMapEntry |
---|
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PairMapEntry(K key, V value)
PairMapEntry
.
Method Detail |
---|
public K getKey()
AbstractMapEntry
getKey
in interface Map.Entry<K,V>
getKey
in class AbstractMapEntry<K,V>
public V getValue()
AbstractMapEntry
remove()
operation), the results of this call are
undefined.
getValue
in interface Map.Entry<K,V>
getValue
in class AbstractMapEntry<K,V>
protected K setKey(K newKey)
public V setValue(V newValue)
AbstractMapEntry
remove()
operation).
setValue
in interface Map.Entry<K,V>
setValue
in class AbstractMapEntry<K,V>
|
JUtil | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |