java.lang.Object | +--org.apache.commons.collections.map.AbstractMapDecorator | +--org.apache.commons.collections.map.LazyMapAll Implemented Interfaces:
The factory to use to construct elements |
LazyMap(Map map, Factory factory) Constructor that wraps (not copies). |
LazyMap(Map map, Transformer factory) Constructor that wraps (not copies). |
static Map | decorate(Map map, Factory factory) Factory method to create a lazily instantiated map. |
static Map | decorate(Map map, Transformer factory) Factory method to create a lazily instantiated map. |
Object | get(Object key) |
protected final Transformer factory
protected LazyMap(Map map, Factory factory)
- if map or factory is nullprotected LazyMap(Map map, Transformer factory)
- if map or factory is nullpublic static Map decorate(Map map, Factory factory)
- if map or factory is nullpublic static Map decorate(Map map, Transformer factory)
- if map or factory is nullpublic Object get(Object key)
Map
to create objects in the map on demand. When the get(Object) method is called with a key that does not exist in the map, the factory is used to create the object. The created object will be added to the map using the requested key. For instance: After the above code is executed,obj
will contain a newDate
instance. Furthermore, thatDate
instance is mapped to the "NOW" key in the map.