|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap<K,V> net.sf.molae.pipe.genimpl.KeySetBasedMap<K,V>
public abstract class KeySetBasedMap<K,V>
Base class for maps that are defined by a key set and a mapping
that defines the key for each value.
Inheriting classes must implement
keySet()
and get(Object)
.
To implement a modifiable map, the programmer must additionally override
this class's put(Object,Object)
method (which otherwise throws
an UnsupportedOperationException), and the iterator returned by
keySet().iterator() must additionally implement its
remove method.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Constructor Summary | |
---|---|
KeySetBasedMap()
|
Method Summary | |
---|---|
void |
clear()
Removes all mappings from this map (optional operation). |
boolean |
containsKey(Object key)
Returns true if this map contains a mapping for the specified key. |
Set<Map.Entry<K,V>> |
entrySet()
Returns a set view of the mappings contained in this map. |
abstract V |
get(Object key)
Returns the value to which this map maps the specified key. |
abstract Set<K> |
keySet()
Returns a set view of the keys contained in this map. |
V |
remove(Object key)
Removes the mapping for this key from this map if present (optional operation). |
int |
size()
Returns the number of mappings in this map. |
Methods inherited from class java.util.AbstractMap |
---|
clone, containsValue, equals, hashCode, isEmpty, put, putAll, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public KeySetBasedMap()
Method Detail |
---|
public Set<Map.Entry<K,V>> entrySet()
entrySet
in interface Map<K,V>
entrySet
in class AbstractMap<K,V>
public int size()
size
in interface Map<K,V>
size
in class AbstractMap<K,V>
public boolean containsKey(Object key)
keySet().contains(key)
.
containsKey
in interface Map<K,V>
containsKey
in class AbstractMap<K,V>
key
- key whose presence in this map is to be tested.
public abstract V get(Object key)
get
in interface Map<K,V>
get
in class AbstractMap<K,V>
key
- key whose associated value is to be returned.
ClassCastException
- if the specified key is of an inappropriate
type for this map.
NullPointerException
- if the key is null and this map
does not not permit null keys.public V remove(Object key)
This implementation removes the specified key from the keySet().
remove
in interface Map<K,V>
remove
in class AbstractMap<K,V>
key
- key whose mapping is to be removed from the map.
UnsupportedOperationException
- if the remove
operation is not supported by the key set.public void clear()
clear
in interface Map<K,V>
clear
in class AbstractMap<K,V>
UnsupportedOperationException
- clear is not supported
by this map.public abstract Set<K> keySet()
keySet
in interface Map<K,V>
keySet
in class AbstractMap<K,V>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |