K
- keys type.V
- values type.public class HashMultiValMap<K,V> extends Object implements MultiValMap<K,V>, Serializable
Constructor and Description |
---|
HashMultiValMap() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(K key)
Find out whether the given key has any values associated.
|
Collection<V> |
get(K key)
Retrieve a collection of values associated with key.
|
Collection<K> |
keys()
Get a collection of associated keys.
|
void |
put(K key,
Collection<V> vs)
Associate all value with this key.
|
void |
put(K key,
V value)
Associate value with key.
|
void |
remove(K key,
Collection<V> vs)
Remove all given values from the key.
|
void |
remove(K key,
V value)
Remove this value from the key.
|
void |
removeAll(K key)
Remove all values associated with this key.
|
int |
size()
Get the number of keys in this map.
|
public boolean containsKey(K key)
MultiValMap
containsKey
in interface MultiValMap<K,V>
key
- the key to look up.public Collection<V> get(K key)
MultiValMap
get
in interface MultiValMap<K,V>
key
- the key to look up.public void put(K key, V value)
MultiValMap
put
in interface MultiValMap<K,V>
key
- the key to add.value
- the associated value.public void put(K key, Collection<V> vs)
MultiValMap
put
in interface MultiValMap<K,V>
key
- a key.vs
- associated values.public void remove(K key, V value)
MultiValMap
remove
in interface MultiValMap<K,V>
key
- the key to remove the value from.value
- the value to remove.public void remove(K key, Collection<V> vs)
MultiValMap
remove
in interface MultiValMap<K,V>
key
- the key to remove values from.vs
- the value to remove.public void removeAll(K key)
MultiValMap
removeAll
in interface MultiValMap<K,V>
key
- the key to remove all values from.public Collection<K> keys()
MultiValMap
keys
in interface MultiValMap<K,V>
public int size()
MultiValMap
size
in interface MultiValMap<K,V>