|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
net.sf.molae.pipe.basic.AbstractMapWithSet<K,V>
net.sf.molae.pipe.filter.KeyFilteredMap<K,V>
public final class KeyFilteredMap<K,V>
Implements a map that contains all entries of a base map of which the key matches a filter condition.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class net.sf.molae.pipe.basic.AbstractMapWithSet |
|---|
AbstractMapWithSet.EntrySet |
| 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 | |
|---|---|
KeyFilteredMap(Map<K,V> base,
TypedPredicate<? super K> filter)
Constructs a filtered map from the specified map and filter. |
|
| Method Summary | |
|---|---|
protected void |
assertRange(K key)
Checks if the specified object fulfils the filter predicate of this class. |
boolean |
containsKey(Object key)
Returns true if the base map contains a mapping for the specified key and the key matches the underlying filter. |
V |
get(Object key)
Returns the value to which the base map maps the specified key if the key matches the underlying filter. |
protected Iterator<Map.Entry<K,V>> |
getEntrySetIterator()
Returns the iterator of the entry set. |
Set<K> |
keySet()
Returns a set view of the keys contained in this map. |
V |
put(K key,
V value)
Associates the specified value with the specified key in the base map if the key matches the underlying filter. |
V |
remove(Object key)
Removes the mapping for this key from this map if present and the key matches the underlying filter. |
| Methods inherited from class net.sf.molae.pipe.basic.AbstractMapWithSet |
|---|
entrySet, size |
| Methods inherited from class java.util.AbstractMap |
|---|
clear, clone, containsValue, equals, hashCode, isEmpty, putAll, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public KeyFilteredMap(Map<K,V> base,
TypedPredicate<? super K> filter)
base - the underlying mapfilter - predicate that determines which keys belong to the map
NullPointerException - if the specified objects are
null.| Method Detail |
|---|
protected Iterator<Map.Entry<K,V>> getEntrySetIterator()
AbstractMapWithSet
getEntrySetIterator in class AbstractMapWithSet<K,V>protected void assertRange(K key)
key - parameter of another method of this class.
IllegalArgumentException - if the specified object does not
fulfil the filter predicate of this class.public boolean containsKey(Object key)
containsKey in interface Map<K,V>containsKey in class AbstractMap<K,V>ClassCastException - depending on the base map
NullPointerException - depending on the base mappublic V get(Object key)
get in interface Map<K,V>get in class AbstractMap<K,V>ClassCastException - depending on the base map
NullPointerException - depending on the base map
public V put(K key,
V value)
put in interface Map<K,V>put in class AbstractMap<K,V>UnsupportedOperationException - depending on the base map
ClassCastException - depending on the base map
IllegalArgumentException - depending on the base map
NullPointerException - depending on the base mappublic V remove(Object key)
remove in interface Map<K,V>remove in class AbstractMap<K,V>UnsupportedOperationException - depending on the base mappublic Set<K> keySet()
AbstractMapWithSettypesafe version of the key set
from AbstractMap
keySet in interface Map<K,V>keySet in class AbstractMapWithSet<K,V>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||