|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>
cz.cuni.amis.utils.maps.LazyMapMap<PRIMARY_KEY,SECONDARY_KEY,ITEM>
PRIMARY_KEY - SECONDARY_KEY - ITEM - public abstract class LazyMapMap<PRIMARY_KEY,SECONDARY_KEY,ITEM>
Map containing other maps. Whenever a map under some key is requested and does not exists, the HashMapMap automatically creates new one.
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).
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Constructor Summary | |
|---|---|
LazyMapMap()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.util.HashMap |
|---|
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, put, putAll, size, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public LazyMapMap()
| Method Detail |
|---|
protected 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_KEY
public 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 -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||