Package org.drasyl.util
Interface Multimap<K,V>
-
- Type Parameters:
K
- the type of keys maintained by this mapV
- the type of mapped values
- All Known Subinterfaces:
SetMultimap<K,V>
- All Known Implementing Classes:
HashSetMultimap
public interface Multimap<K,V>
A map in which more than one value may be associated with and returned for a given key
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<V>
get(Object key)
Returns the values that are associated to the specifiedkey
.Set<K>
keySet()
Returns aSet
with all the keys contained in this map.boolean
put(K key, V value)
Associates the specifiedvalue
with the specifiedkey
in this map.boolean
remove(K key, V value)
Removes the specifiedvalue
from the specifiedkey
.
-
-
-
Method Detail
-
put
boolean put(K key, V value)
Associates the specifiedvalue
with the specifiedkey
in this map.- Parameters:
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key- Returns:
true
if the specifiedvalue
could be associated with the specifiedkey
- Throws:
NullPointerException
- ifkey
isnull
-
remove
boolean remove(K key, V value)
Removes the specifiedvalue
from the specifiedkey
. If no value left, the associatedkey
will be removed from the map.- Parameters:
key
- key with which the specified value is associatedvalue
- value expected to be associated with the specified key- Returns:
true
if the specifiedvalue
could be removed from the specifiedkey
- Throws:
NullPointerException
- ifkey
isnull
-
get
Collection<V> get(Object key)
Returns the values that are associated to the specifiedkey
. Returns a emptyCollection
if currently no values are assosicated to thekey
.- Parameters:
key
- the key whose associated values should be returned- Returns:
- the values that are associated to the specified
key
. Returns a emptyCollection
if currently no values are assosicated to thekey
. - Throws:
NullPointerException
- ifkey
isnull
-
-