com.googlecode.whatswrong.javautils
Class HashMultiMapArrayList<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,java.util.List<V>>
com.googlecode.whatswrong.javautils.HashMultiMapArrayList<K,V>
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map<K,java.util.List<V>>
public class HashMultiMapArrayList<K,V>
- extends java.util.HashMap<K,java.util.List<V>>
A HashMultiMapArrayList is a mapping from keys to array lists of values.
- Author:
- Sebastian Riedel
- 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> |
Field Summary |
protected java.util.List<V> |
emptyList
the empty list to be returned when there is key without values. |
Method Summary |
void |
add(K key,
V value)
Adds a value to the list of values of the given key. |
HashMultiMapArrayList<K,V> |
deepcopy()
Creates a deep copy of this mapping. |
java.util.List<V> |
get(java.lang.Object o)
Returns the list of values associated with the given key. |
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, 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 |
emptyList
protected java.util.List<V> emptyList
- the empty list to be returned when there is key without values.
HashMultiMapArrayList
public HashMultiMapArrayList()
add
public void add(K key,
V value)
- Adds a value to the list of values of the given key.
- Parameters:
key
- the key value.value
- the value to add to the list of values of the given key.
deepcopy
public HashMultiMapArrayList<K,V> deepcopy()
- Creates a deep copy of this mapping.
- Returns:
- A deep copy of this mapping.
get
public java.util.List<V> get(java.lang.Object o)
- Returns the list of values associated with the given key.
- Specified by:
get
in interface java.util.Map<K,java.util.List<V>>
- Overrides:
get
in class java.util.HashMap<K,java.util.List<V>>
- Parameters:
o
- the key to get the values for.
- Returns:
- a list of values for the given keys or the empty list of no such value exist.
Copyright © 2010. All Rights Reserved.