|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap<K,V> java.util.HashMap<PRIMARY_KEY,java.util.Map<SECONDARY_KEY,ITEM>> cz.cuni.amis.utils.maps.HashMapMap<PRIMARY_KEY,SECONDARY_KEY,ITEM>
PRIMARY_KEY
- SECONDARY_KEY
- ITEM
- public class HashMapMap<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 |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Constructor Summary | |
---|---|
HashMapMap()
|
|
HashMapMap(int primaryCapacity,
int secondaryCapacity)
|
Method Summary | |
---|---|
java.util.Map<SECONDARY_KEY,ITEM> |
get(java.lang.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. |
java.util.Map<SECONDARY_KEY,ITEM> |
remove(java.lang.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 HashMapMap()
public HashMapMap(int primaryCapacity, int secondaryCapacity)
Method Detail |
---|
public java.util.Map<SECONDARY_KEY,ITEM> get(java.lang.Object primaryKey)
get
in interface java.util.Map<PRIMARY_KEY,java.util.Map<SECONDARY_KEY,ITEM>>
get
in class java.util.HashMap<PRIMARY_KEY,java.util.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 java.util.Map<SECONDARY_KEY,ITEM> remove(java.lang.Object primaryKey)
remove
in interface java.util.Map<PRIMARY_KEY,java.util.Map<SECONDARY_KEY,ITEM>>
remove
in class java.util.HashMap<PRIMARY_KEY,java.util.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 |