cz.cuni.amis.utils.maps
Class WeakHashMapMap<PRIMARY_KEY,SECONDARY_KEY,ITEM>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.WeakHashMap<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>
cz.cuni.amis.utils.maps.WeakHashMapMap<PRIMARY_KEY,SECONDARY_KEY,ITEM>
- Type Parameters:
PRIMARY_KEY
- SECONDARY_KEY
- ITEM
-
- All Implemented Interfaces:
- Map<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>
public class WeakHashMapMap<PRIMARY_KEY,SECONDARY_KEY,ITEM>
- extends WeakHashMap<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>
Two-level hashMap where the first-level keys are weakly referenced!
This means that if the key is not strongly referenced elsewhere, the maps can be garbage collected.
- Author:
- srlok
WeakHashMapMap
public WeakHashMapMap()
get
public Map<SECONDARY_KEY,ITEM> get(Object primaryKey)
- Specified by:
get
in interface Map<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>
- Overrides:
get
in class WeakHashMap<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>
get
public ITEM get(PRIMARY_KEY primaryKey,
SECONDARY_KEY secondaryKey)
- Returns the requested item under primary and secondary key.
- Parameters:
primaryKey
- weakly-referencedsecondaryKey
-
- Returns:
- if no such item exists returns NULL
put
public ITEM put(PRIMARY_KEY primaryKey,
SECONDARY_KEY secondaryKey,
ITEM item)
- Inserts item under primary and secondary_key.
- Parameters:
primaryKey
- weakly-referencedsecondaryKey
- item
-
- Returns:
- inserted item
remove
public ITEM remove(PRIMARY_KEY primaryKey,
SECONDARY_KEY secondaryKey)
- removes the item under primary and secondary key.
- Parameters:
primaryKey
- secondaryKey
-
- Returns:
- removed item
remove
public Map<SECONDARY_KEY,ITEM> remove(Object primaryKey)
- removes all items under primaryKey
- Specified by:
remove
in interface Map<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>
- Overrides:
remove
in class WeakHashMap<PRIMARY_KEY,Map<SECONDARY_KEY,ITEM>>
- Parameters:
primaryKey
-
- Returns:
- map of all removed items
Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.