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
Modifier and TypeMethodDescriptionvoid
clear()
Removes all entries from this multimap.Returns the values that are associated to the specifiedkey
.boolean
isEmpty()
Returnstrue
if this multimap contains no entries.keySet()
Returns aSet
with all the keys contained in this map.boolean
Associates the specifiedvalue
with the specifiedkey
in this map.boolean
putAll
(K key, Collection<? extends V> values) Associates the specifiedvalues
with the specifiedkey
in this map.boolean
Associates the specifiedvalues
with the specifiedkey
in this map.boolean
Removes the specifiedvalue
from the specifiedkey
.
-
Method Details
-
put
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
-
putAll
Associates the specifiedvalues
with the specifiedkey
in this map.- Parameters:
key
- key with which the specified value is to be associatedvalues
- values to be associated with the specified key- Returns:
true
if the specifiedvalues
have changed this multimap- Throws:
NullPointerException
- ifkey
isnull
-
putAll
Associates the specifiedvalues
with the specifiedkey
in this map.- Parameters:
key
- key with which the specified value is to be associatedvalues
- values to be associated with the specified key- Returns:
true
if the specifiedvalues
have changed this multimap- Throws:
NullPointerException
- ifkey
isnull
-
remove
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
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
-
keySet
Returns aSet
with all the keys contained in this map.- Returns:
Set
with all the keys contained in this map
-
isEmpty
boolean isEmpty()Returnstrue
if this multimap contains no entries.- Returns:
true
if this multimap contains no entries
-
clear
void clear()Removes all entries from this multimap.
-