Package io.joynr.util
Class MultiMap<K,V>
- java.lang.Object
-
- io.joynr.util.MultiMap<K,V>
-
- All Implemented Interfaces:
Serializable
public class MultiMap<K,V> extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MultiMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(K key)Set<V>get(K key)Set<V>getAndRemoveAll(K key)booleanisEmpty()Set<K>keySet()voidput(K key, V value)Stores akey-valuepair.booleanremove(K key, V value)Removeskey-valuepair if it exists.voidremoveAll(K key)Removes all values associated withkey.intsize()
-
-
-
Method Detail
-
containsKey
public boolean containsKey(K key)
- Parameters:
key- key- Returns:
trueif at least one key-value pair exists forkey
-
isEmpty
public boolean isEmpty()
- Returns:
trueif empty
-
get
public Set<V> get(K key)
- Parameters:
key- key- Returns:
- a set view of the values associated with
key
-
getAndRemoveAll
public Set<V> getAndRemoveAll(K key)
- Parameters:
key- key- Returns:
- a set view of the values associated with
keythen remove it from the container storage
-
remove
public boolean remove(K key, V value)
Removeskey-valuepair if it exists.- Parameters:
key- keyvalue- value- Returns:
trueif pair was removed,falseotherwise
-
removeAll
public void removeAll(K key)
Removes all values associated withkey.- Parameters:
key- key
-
size
public int size()
- Returns:
- number of key-value pairs in this multimap
-
-