|
||||||||||
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<KEY,Set<ITEM>> cz.cuni.amis.utils.maps.HashMapSet<KEY,ITEM>
KEY
- ITEM
- public class HashMapSet<KEY,ITEM>
Map containing sets. Whenever a set under some key is requested and does not exists, the HashMapSet automatically creates new one.
The implementation is unsynchronized, created sets are synchronized (just iteration over the set 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 | |
---|---|
HashMapSet()
|
Method Summary | |
---|---|
void |
add(KEY key,
ITEM item)
Adds the item into the set under the key. |
boolean |
contains(KEY key,
ITEM item)
Tests whether an 'item' is inside the set under 'key'. |
Set<ITEM> |
get(Object primaryKey)
The get method ensures that the requested set under primaryKey always exists! |
boolean |
remove(KEY key,
ITEM item)
Removes the item from the set under the key. |
Set<ITEM> |
remove(Object key)
Remove returns the removed item, if item was non-existent, it returns empty set. |
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 HashMapSet()
Method Detail |
---|
public Set<ITEM> get(Object primaryKey)
get
in interface Map<KEY,Set<ITEM>>
get
in class HashMap<KEY,Set<ITEM>>
primaryKey
- must be instance of PRIMARY_KEYpublic void add(KEY key, ITEM item)
key
- item
- public Set<ITEM> remove(Object key)
remove
in interface Map<KEY,Set<ITEM>>
remove
in class HashMap<KEY,Set<ITEM>>
primaryKey
-
public boolean remove(KEY key, ITEM item)
key
- item
- public boolean contains(KEY key, ITEM item)
key
- item
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |