org.eclipse.smila.utils.collections
Class MultiValueMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,java.util.List<V>>
org.eclipse.smila.utils.collections.MultiValueMap<K,V>
- Type Parameters:
K
- class of the keys of this mapV
- class of the map values. Note that the action map value type is List, because this map stores multiple
values for each key
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map<K,java.util.List<V>>
public class MultiValueMap<K,V>
- extends java.util.HashMap<K,java.util.List<V>>
allows multiple values to be stored against a single key.
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class java.util.AbstractMap |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Method Summary |
java.lang.Object |
add(K key,
V value)
add another value to the given key. |
void |
addKey(K key)
set an empty value list. |
java.util.List<V> |
getValues(K key)
|
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, 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 |
MultiValueMap
public MultiValueMap()
- Default Constructor.
MultiValueMap
public MultiValueMap(int size)
- Conversion Constructor.
- Parameters:
size
- the initial size of this map
getValues
public java.util.List<V> getValues(K key)
- Parameters:
key
- a key
- Returns:
- a list of values for this key
add
public java.lang.Object add(K key,
V value)
- add another value to the given key.
- Parameters:
key
- keyvalue
- a new value
- Returns:
- the value.
addKey
public void addKey(K key)
- set an empty value list. for the given key. Existing values will be overwritten.
- Parameters:
key
- the key