|
|||||||||
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.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 |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.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. |
java.util.List<ITEM> |
get(java.lang.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. |
java.util.List<ITEM> |
remove(java.lang.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 java.util.List<ITEM> get(java.lang.Object key)
get
in interface java.util.Map<KEY,java.util.List<ITEM>>
get
in class java.util.HashMap<KEY,java.util.List<ITEM>>
public void add(KEY key, ITEM item)
key
- item
- public java.util.List<ITEM> remove(java.lang.Object key)
remove
in interface java.util.Map<KEY,java.util.List<ITEM>>
remove
in class java.util.HashMap<KEY,java.util.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 |