Package org.drasyl.util
Class HashSetMultimap<K,V>
- java.lang.Object
-
- org.drasyl.util.HashSetMultimap<K,V>
-
- Type Parameters:
K
- the type of keys maintained by this mapV
- the type of mapped values
- All Implemented Interfaces:
Multimap<K,V>
,SetMultimap<K,V>
public class HashSetMultimap<K,V> extends Object implements SetMultimap<K,V>
Hash table based implementation of theSetMultimap
interface.This data structure is not thread-safe!
-
-
Constructor Summary
Constructors Constructor Description HashSetMultimap()
HashSetMultimap(int initialMapCapacity, int initialSetCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<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
public boolean put(K key, V value)
Description copied from interface:Multimap
Associates the specifiedvalue
with the specifiedkey
in this map.
-
remove
public boolean remove(K key, V value)
Description copied from interface:Multimap
Removes the specifiedvalue
from the specifiedkey
. If no value left, the associatedkey
will be removed from the map.
-
get
public Set<V> get(Object key)
Description copied from interface:Multimap
Returns the values that are associated to the specifiedkey
. Returns a emptyCollection
if currently no values are assosicated to thekey
.- Specified by:
get
in interfaceMultimap<K,V>
- Specified by:
get
in interfaceSetMultimap<K,V>
- 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
.
-
-