PRIMARY_KEY - SECONDARY_KEY - ITEM - public abstract class LazyMapMap<PRIMARY_KEY,SECONDARY_KEY,ITEM> extends HashMap<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>
The implementation is unsynchronized, created maps are synchronized (just iteration over the inner-map must be synchronized by the user as described in Java(tm) documentation).
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
LazyMapMap() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract ITEM |
create(SECONDARY_KEY key)
Creates value for given key.
|
Map<SECONDARY_KEY,ITEM> |
get(Object primaryKey)
The get method ensures that the requested map under primaryKey always exists!
|
ITEM |
get(PRIMARY_KEY primaryKey,
SECONDARY_KEY secondaryKey)
Returns an item under primary and secondary key if exists (otherwise a null is returned).
|
void |
put(PRIMARY_KEY primaryKey,
SECONDARY_KEY secondaryKey,
ITEM item)
Inserts an item under primary and then secondary key.
|
Map<SECONDARY_KEY,ITEM> |
remove(Object primaryKey)
Remove returns the removed item, if item was non-existent, it returns empty map.
|
ITEM |
remove(PRIMARY_KEY primaryKey,
SECONDARY_KEY secondaryKey)
Removes an item from the map.
|
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, put, putAll, size, valuesequals, hashCode, toStringprotected abstract ITEM create(SECONDARY_KEY key)
key - public Map<SECONDARY_KEY,ITEM> get(Object primaryKey)
get in interface Map<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>get in class HashMap<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>primaryKey - must be instance of PRIMARY_KEYpublic ITEM get(PRIMARY_KEY primaryKey, SECONDARY_KEY secondaryKey)
primaryKey - secondaryKey - public void put(PRIMARY_KEY primaryKey, SECONDARY_KEY secondaryKey, ITEM item)
primaryKey - secondaryKey - item - public Map<SECONDARY_KEY,ITEM> remove(Object primaryKey)
remove in interface Map<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>remove in class HashMap<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>primaryKey - public ITEM remove(PRIMARY_KEY primaryKey, SECONDARY_KEY secondaryKey)
primaryKey - secondaryKey - Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.