|
|||||||||
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,java.util.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 |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.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'. |
java.util.Set<ITEM> |
get(java.lang.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. |
java.util.Set<ITEM> |
remove(java.lang.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 java.util.Set<ITEM> get(java.lang.Object primaryKey)
get
in interface java.util.Map<KEY,java.util.Set<ITEM>>
get
in class java.util.HashMap<KEY,java.util.Set<ITEM>>
primaryKey
- must be instance of PRIMARY_KEYpublic void add(KEY key, ITEM item)
key
- item
- public java.util.Set<ITEM> remove(java.lang.Object key)
remove
in interface java.util.Map<KEY,java.util.Set<ITEM>>
remove
in class java.util.HashMap<KEY,java.util.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 |