|
||||||||||
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,List<ITEM>> cz.cuni.amis.utils.maps.HashMapList<KEY,ITEM>
KEY
- ITEM
- public class HashMapList<KEY,ITEM>
Map containing lists of items. Whenever a list under some key is requested and does not exists, the HashMapList automatically creates new one.
The implementation is unsynchronized, created lists are synchronized (just iteration over list 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 | |
---|---|
HashMapList()
|
Method Summary | |
---|---|
void |
add(KEY key,
ITEM item)
Add a new item at the end of the list under a specific key. |
List<ITEM> |
get(Object key)
Returns a list under a specific key in the map. |
ITEM |
peek(KEY key)
Returns first item from the list under a specific key. |
ITEM |
pull(KEY key)
Removes first item from the list under a specific key. |
ITEM |
remove(KEY key,
int index)
Remove an item at 'index' from the list under a specific key. |
List<ITEM> |
remove(Object key)
Remove returns the removed item, if item was non-existent, it returns empty list. |
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 HashMapList()
Method Detail |
---|
public List<ITEM> get(Object key)
get
in interface Map<KEY,List<ITEM>>
get
in class HashMap<KEY,List<ITEM>>
public void add(KEY key, ITEM item)
key
- item
- public List<ITEM> remove(Object key)
remove
in interface Map<KEY,List<ITEM>>
remove
in class HashMap<KEY,List<ITEM>>
key
-
public ITEM remove(KEY key, int index)
key
- index
-
public ITEM peek(KEY key)
key
-
public ITEM pull(KEY key)
key
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |