PRIMARY_KEY
- SECONDARY_KEY
- ITEM
- public class HashMapMap<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 |
---|
HashMapMap() |
HashMapMap(int primaryCapacity,
int secondaryCapacity) |
Modifier and Type | Method and Description |
---|---|
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, values
equals, hashCode, toString
public HashMapMap()
public HashMapMap(int primaryCapacity, int secondaryCapacity)
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.