K
- the type of the map's keysV
- the type of the map's valuespublic class SetMultiMap<K,V> extends java.lang.Object implements MultiMap<K,V>
Constructor and Description |
---|
SetMultiMap() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all of the mappings from this map (optional operation).
|
boolean |
containsKey(java.lang.Object key)
Returns true if this map contains a mapping for the specified key.
|
boolean |
containsValue(java.lang.Object value)
Returns true if this map maps one or more keys to the specified value.
|
java.util.Set<java.util.Map.Entry<K,V>> |
entries()
Returns a collection view of the mappings contained in this map.
|
boolean |
equals(java.lang.Object obj) |
java.util.Set<V> |
get(java.lang.Object key)
Returns the values to which the specified key is mapped, or null if this
map contains no mapping for the key.
|
java.util.Set<V> |
getEmptyCollection()
Provides an empty collection of the appropriate type to hold values.
|
int |
hashCode() |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings.
|
java.util.Set<K> |
keySet()
Returns a set view of the keys contained in this map.
|
void |
put(K key,
java.util.Collection<V> values)
Associates the specified values with the specified key in this map
(optional operation).
|
void |
put(K key,
V value)
Associates the specified value with the specified key in this map
(optional operation).
|
void |
putAll(java.util.Map<? extends K,? extends V> map)
Copies all of the mappings from the specified map to this map (optional
operation).
|
void |
putAll(MultiMap<? extends K,? extends V> map)
Copies all of the mappings from the specified multimap to this map
(optional operation).
|
java.util.Set<V> |
remove(java.lang.Object key)
Removes the mapping for a key from this map if it is present (optional
operation).
|
int |
size()
Returns the number of key-value mappings in this map.
|
java.lang.String |
toString() |
java.util.Collection<V> |
values()
Returns a collection view of the values contained in this map.
|
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, putIfAbsent, remove, replace, replace, replace, replace, replaceAll
public void clear()
MultiMap
public boolean containsKey(java.lang.Object key)
MultiMap
containsKey
in interface MultiMap<K,V>
key
- key whose presence in this map is to be testedpublic boolean containsValue(java.lang.Object value)
MultiMap
containsValue
in interface MultiMap<K,V>
value
- value whose presence in this map is to be testedpublic java.util.Set<java.util.Map.Entry<K,V>> entries()
MultiMap
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.util.Set<V> get(java.lang.Object key)
MultiMap
public java.util.Set<V> getEmptyCollection()
MultiMap
getEmptyCollection
in interface MultiMap<K,V>
public int hashCode()
hashCode
in class java.lang.Object
public boolean isEmpty()
MultiMap
public java.util.Set<K> keySet()
MultiMap
public void put(K key, java.util.Collection<V> values)
MultiMap
public void put(K key, V value)
MultiMap
public void putAll(java.util.Map<? extends K,? extends V> map)
MultiMap
public void putAll(MultiMap<? extends K,? extends V> map)
MultiMap
public java.util.Set<V> remove(java.lang.Object key)
MultiMap
public int size()
MultiMap
public java.lang.String toString()
toString
in class java.lang.Object