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 TypeMethodDescriptionvoidclear()Removes all entries from this multimap.Returns the values that are associated to the specifiedkey.booleanisEmpty()Returnstrueif this multimap contains no entries.keySet()Returns aSetwith all the keys contained in this map.booleanAssociates the specifiedvaluewith the specifiedkeyin this map.booleanputAll(K key, Collection<? extends V> values) Associates the specifiedvalueswith the specifiedkeyin this map.booleanAssociates the specifiedvalueswith the specifiedkeyin this map.booleanRemoves the specifiedvaluefrom the specifiedkey.
-
Method Details
-
put
Associates the specifiedvaluewith the specifiedkeyin this map.- Parameters:
key- key with which the specified value is to be associatedvalue- value to be associated with the specified key- Returns:
trueif the specifiedvaluecould be associated with the specifiedkey- Throws:
NullPointerException- ifkeyisnull
-
putAll
Associates the specifiedvalueswith the specifiedkeyin this map.- Parameters:
key- key with which the specified value is to be associatedvalues- values to be associated with the specified key- Returns:
trueif the specifiedvalueshave changed this multimap- Throws:
NullPointerException- ifkeyisnull
-
putAll
Associates the specifiedvalueswith the specifiedkeyin this map.- Parameters:
key- key with which the specified value is to be associatedvalues- values to be associated with the specified key- Returns:
trueif the specifiedvalueshave changed this multimap- Throws:
NullPointerException- ifkeyisnull
-
remove
Removes the specifiedvaluefrom the specifiedkey. If no value left, the associatedkeywill 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:
trueif the specifiedvaluecould be removed from the specifiedkey- Throws:
NullPointerException- ifkeyisnull
-
get
Returns the values that are associated to the specifiedkey. Returns a emptyCollectionif 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 emptyCollectionif currently no values are assosicated to thekey. - Throws:
NullPointerException- ifkeyisnull
-
keySet
Returns aSetwith all the keys contained in this map.- Returns:
Setwith all the keys contained in this map
-
isEmpty
boolean isEmpty()Returnstrueif this multimap contains no entries.- Returns:
trueif this multimap contains no entries
-
clear
void clear()Removes all entries from this multimap.
-