com.googlecode.whatswrong.javautils
Class HashMultiMapArrayList<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,List<V>>
com.googlecode.whatswrong.javautils.HashMultiMapArrayList<K,V>
- All Implemented Interfaces:
- Serializable, Cloneable, Map<K,List<V>>
public class HashMultiMapArrayList<K,V>
- extends HashMap<K,List<V>>
A HashMultiMapArrayList is a mapping from keys to array lists of values.
- Author:
- Sebastian Riedel
- See Also:
- Serialized Form
|
Field Summary |
protected List<V> |
emptyList
the empty list to be returned when there is key without values. |
| Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
emptyList
protected 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 List<V> get(Object o)
- Returns the list of values associated with the given key.
- Specified by:
get in interface Map<K,List<V>>- Overrides:
get in class HashMap<K,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 © 2013. All Rights Reserved.