public class MultiMap extends HashMap
MultiMap
, which is basically a Map
with multiple values for a key. This will be removed when SUN see sense and
include it in the JDK java.util package as standard.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
MultiMap()
Constructor.
|
MultiMap(int initialCapacity)
Constructor.
|
MultiMap(int initialCapacity,
float loadFactor)
Constructor.
|
MultiMap(MultiMap map)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the map.
|
Object |
clone()
Method to clone the Map.
|
boolean |
containsValue(Object value)
Check if the map contains the passed value.
|
protected Collection |
createCollection(Collection c)
Creates a new instance of the map value Collection container.
|
Object |
put(Object key,
Object value)
Add a key, and its value, to the map.
|
Object |
removeKeyValue(Object key,
Object item)
Removes a specific key,value pairing from map.
|
Collection |
values()
Accessor for the values in the Map.
|
compute, computeIfAbsent, computeIfPresent, containsKey, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
equals, hashCode, toString
public MultiMap()
public MultiMap(int initialCapacity)
initialCapacity
- the initial capacitypublic MultiMap(int initialCapacity, float loadFactor)
initialCapacity
- initial capacityloadFactor
- load factor for the Map.public MultiMap(MultiMap map)
map
- The initial Map.public boolean containsValue(Object value)
containsValue
in interface Map
containsValue
in class HashMap
value
- the value to search forpublic Object removeKeyValue(Object key, Object item)
key
- the key to remove fromitem
- the value to removepublic void clear()
public Collection values()
public Object clone()
protected Collection createCollection(Collection c)
c
- the collection to copyCopyright © 2019. All rights reserved.