Interface MultiMap<K,V>
-
- Type Parameters:
K- the type of keyV- the type of value
- All Known Implementing Classes:
MapOfSets
public interface MultiMap<K,V>Map-like data structure where keys may correspond to multiple values.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclear()Clear the map of all entries.Collection<V>get(K key)Get all of the values associated with the specified key.Set<K>keySet()Get the Set containing all keys in the map.voidput(K key, Collection<V> values)Add a collection of values to the specified key.booleanput(K key, V value)Add a value to the specified key.default voidputAll(MultiMap<K,V> map)Add all of the contents of anotherMultiMapto this instance.booleanremove(K key, V value)Remove value for the specified key.
-
-
-
Method Detail
-
put
boolean put(K key, V value)
Add a value to the specified key.- Parameters:
key- the key to add a value tovalue- the value to add- Returns:
- true if the operation was successful, otherwise false
-
put
void put(K key, Collection<V> values)
Add a collection of values to the specified key.- Parameters:
key- the key to add the values tovalues- the values to add
-
remove
boolean remove(K key, V value)
Remove value for the specified key.- Parameters:
key- the key for the value to be removedvalue- the value to be removed- Returns:
- true if the operation was successful, otherwise false
-
get
Collection<V> get(K key)
Get all of the values associated with the specified key.- Parameters:
key- the key to lookup- Returns:
- a collection containing all of the values
-
clear
void clear()
Clear the map of all entries.
-
-