com.acsinet_solutions.util.adt
Class LazyMap<K,V>
java.lang.Object
com.acsinet_solutions.util.adt.MapDelegator<K,V>
com.acsinet_solutions.util.adt.LazyMap<K,V>
- All Implemented Interfaces:
- java.util.Map<K,V>
public class LazyMap<K,V>
- extends MapDelegator<K,V>
This implements a map that delegates to a lazy loaded implementation.
Jakarta commons collections also offers a lazy map but on a key basis;
this one is different because it loads lazily the entire map on one step.
A lazy object implementation based on dynamic proxies may also be created
if needed.
- Author:
- Santiago Arriaga
| Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
|
Constructor Summary |
LazyMap(ObjectFactory<java.util.Map<K,V>> factory)
Create a new lazy map with a reference to the object factory that will
create the actual map. |
|
Method Summary |
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
V |
get(java.lang.Object key)
|
boolean |
isEmpty()
|
java.util.Set<K> |
keySet()
|
V |
put(K key,
V value)
|
void |
putAll(java.util.Map<? extends K,? extends V> map)
|
V |
remove(java.lang.Object key)
|
void |
reset()
Mark the lazy map as not loaded, so before the next operation a reload
operation of the data must be performed. |
int |
size()
|
java.util.Collection<V> |
values()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
equals, hashCode |
LazyMap
public LazyMap(ObjectFactory<java.util.Map<K,V>> factory)
- Create a new lazy map with a reference to the object factory that will
create the actual map.
clear
public void clear()
- Specified by:
clear in interface java.util.Map<K,V>- Overrides:
clear in class MapDelegator<K,V>
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKey in interface java.util.Map<K,V>- Overrides:
containsKey in class MapDelegator<K,V>
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValue in interface java.util.Map<K,V>- Overrides:
containsValue in class MapDelegator<K,V>
entrySet
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
- Specified by:
entrySet in interface java.util.Map<K,V>- Overrides:
entrySet in class MapDelegator<K,V>
get
public V get(java.lang.Object key)
- Specified by:
get in interface java.util.Map<K,V>- Overrides:
get in class MapDelegator<K,V>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface java.util.Map<K,V>- Overrides:
isEmpty in class MapDelegator<K,V>
keySet
public java.util.Set<K> keySet()
- Specified by:
keySet in interface java.util.Map<K,V>- Overrides:
keySet in class MapDelegator<K,V>
put
public V put(K key,
V value)
- Specified by:
put in interface java.util.Map<K,V>- Overrides:
put in class MapDelegator<K,V>
putAll
public void putAll(java.util.Map<? extends K,? extends V> map)
- Specified by:
putAll in interface java.util.Map<K,V>- Overrides:
putAll in class MapDelegator<K,V>
remove
public V remove(java.lang.Object key)
- Specified by:
remove in interface java.util.Map<K,V>- Overrides:
remove in class MapDelegator<K,V>
size
public int size()
- Specified by:
size in interface java.util.Map<K,V>- Overrides:
size in class MapDelegator<K,V>
values
public java.util.Collection<V> values()
- Specified by:
values in interface java.util.Map<K,V>- Overrides:
values in class MapDelegator<K,V>
reset
public final void reset()
- Mark the lazy map as not loaded, so before the next operation a reload
operation of the data must be performed.