public class FilterMap<K,V>
extends java.util.AbstractMap<K,V>
FilterMap.Filter
to evaluate the value when the value
is retrieved. Then, encapsulate the original map with this class. For example,
return new FilterMap(map,
new FilterMap.Filter() {
public Object filter(Object key, Object value) {
//evaluate the value and return the result
}
});
Notice that this map is readonly, and it is thread-safe if the give map and the filter are both thread safe.
Modifier and Type | Class and Description |
---|---|
static interface |
FilterMap.Filter<V>
Filters the given value (to evaluate when the value is retrieved).
|
Constructor and Description |
---|
FilterMap(java.util.Map<K,V> map,
FilterMap.Filter<V> filter) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(java.lang.Object key) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
boolean |
equals(java.lang.Object o) |
V |
get(java.lang.Object key) |
java.util.Map<K,V> |
getOrigin()
Returns the original map being filtered.
|
int |
hashCode() |
java.lang.String |
toString() |
public FilterMap(java.util.Map<K,V> map, FilterMap.Filter<V> filter)
public java.util.Map<K,V> getOrigin()
public V get(java.lang.Object key)
public boolean containsKey(java.lang.Object key)
public int hashCode()
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.