SMILA (incubation) API documentation

org.eclipse.smila.utils.collections
Class MultiValueMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,java.util.List<V>>
          extended by org.eclipse.smila.utils.collections.MultiValueMap<K,V>
Type Parameters:
K - class of the keys of this map
V - 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 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
MultiValueMap()
          Default Constructor.
MultiValueMap(int size)
          Conversion Constructor.
 
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
 

Constructor Detail

MultiValueMap

public MultiValueMap()
Default Constructor.


MultiValueMap

public MultiValueMap(int size)
Conversion Constructor.

Parameters:
size - the initial size of this map
Method Detail

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 - key
value - 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

SMILA (incubation) API documentation