public class MultiMap<K,V> extends Object implements Serializable
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(K key) |
boolean |
containsValue(V val) |
List<V> |
get(K key)
Get the collection of values associated with a given key.
|
boolean |
isEmpty() |
Set<K> |
keySet()
Get a set of all the keys in this map.
|
void |
put(K key,
Collection<V> values)
Add a key to the map with a collection of elements.
|
void |
put(K key,
V value)
Add an element to the map.
|
V |
remove(K key,
V value)
Remove one value from an existing key.
|
Collection<V> |
removeKey(K key)
Remove all the values associated with the given key
|
int |
size()
Get the number of keys in the map.
|
String |
toString() |
Collection<V> |
values()
Get a single collection of all the values in the map.
|
public MultiMap()
public MultiMap(int size)
size
- Initial size of the mappublic void put(K key, V value)
key
- The key to store the value under. If the key already
exists the value will be added to the collection for that key, it
will not replace the existing value (as in a standard map).value
- value to store.public void put(K key, Collection<V> values)
key
- The key to store the value under. If the key already
exists the value will be added to the collection for that key, it
will not replace the existing value (as in a standard map).values
- collection of values to store.public List<V> get(K key)
key
- Key to fetch values for.public V remove(K key, V value)
key
- Key to remove the value from.value
- Value to remove.public Collection<V> removeKey(K key)
key
- the key to be removedpublic Collection<V> values()
public int size()
public boolean isEmpty()
public void clear()
public boolean containsKey(K key)
public boolean containsValue(V val)
Copyright © 2007-2012 The Apache Software Foundation