ix.util
Class MultiHashMap
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap
ix.util.MultiHashMap
- All Implemented Interfaces:
- MultiMap, java.io.Serializable, java.lang.Cloneable, java.util.Map
- Direct Known Subclasses:
- ContextMultiHashMap
public class MultiHashMap
- extends java.util.HashMap
- implements MultiMap
A MultiHashMap is (by weak analogy with "multiset") a HashMap
that maps each key to a collection of values. When the first
value is added for a given key, the collection that holds that
key's values is created by the makeValueCollection
method. In this class, it creates a LinkedList, but that can
be changed by redefining the method in a subclass.
- 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> |
Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
Method Summary |
java.lang.Object |
addValue(java.lang.Object key,
java.lang.Object value)
|
java.util.Collection |
makeValueCollection(java.lang.Object firstItem)
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Set the entire colletion of values associated with the key. |
boolean |
removeValue(java.lang.Object key,
java.lang.Object value)
|
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, 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 |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values |
MultiHashMap
public MultiHashMap()
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
- Set the entire colletion of values associated with the key.
- Specified by:
put
in interface java.util.Map
- Overrides:
put
in class java.util.HashMap
addValue
public java.lang.Object addValue(java.lang.Object key,
java.lang.Object value)
- Specified by:
addValue
in interface MultiMap
removeValue
public boolean removeValue(java.lang.Object key,
java.lang.Object value)
- Specified by:
removeValue
in interface MultiMap
makeValueCollection
public java.util.Collection makeValueCollection(java.lang.Object firstItem)
- Specified by:
makeValueCollection
in interface MultiMap