KEY
- ITEM
- public class HashMapList<KEY,ITEM> extends HashMap<KEY,List<ITEM>>
The implementation is unsynchronized, created lists are synchronized (just iteration over list must be synchronized by the user as described in Java(tm) documentation).
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
HashMapList() |
Modifier and Type | Method and Description |
---|---|
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.
|
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, put, putAll, size, values
equals, hashCode, toString
public List<ITEM> get(Object key)
public void add(KEY key, ITEM item)
key
- item
- public List<ITEM> remove(Object key)
public ITEM remove(KEY key, int index)
key
- index
- public ITEM peek(KEY key)
key
- Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.