K
- The key type.V
- The value type.public abstract class LazyMap<K,V>
extends java.lang.Object
implements java.util.Map<K,V>
get(Object)
. If the downstream get returns a value then that value is returned to the caller. If the downstream get returns null then the createValue()
method will be called and the result of that is added to the downstream map and returned.Constructor and Description |
---|
LazyMap()
Construct a LazyMap that delegates to a new HashMap.
|
LazyMap(java.util.Map<K,V> downstream)
Construct a LazyMap that delegates to a given map.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
abstract V |
createValue()
Construct a new value object for a key that does not yet have a value.
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
boolean |
equals(java.lang.Object o) |
V |
get(java.lang.Object key) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> m) |
V |
remove(java.lang.Object key) |
int |
size() |
java.util.Collection<V> |
values() |
public abstract V createValue()
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public boolean equals(java.lang.Object o)
public int hashCode()