private static class MapConstraints.ConstrainedSetMultimap<K,V> extends MapConstraints.ConstrainedMultimap<K,V> implements SetMultimap<K,V>
asMap, constraint, delegate, entries
Constructor and Description |
---|
ConstrainedSetMultimap(SetMultimap<K,V> delegate,
MapConstraint<? super K,? super V> constraint) |
Modifier and Type | Method and Description |
---|---|
java.util.Set<java.util.Map.Entry<K,V>> |
entries()
Returns a view collection of all key-value pairs contained in this
multimap, as
Map.Entry instances. |
java.util.Set<V> |
get(K key)
Returns a view collection of the values associated with
key in this
multimap, if any. |
java.util.Set<V> |
removeAll(java.lang.Object key)
Removes all values associated with the key
key . |
java.util.Set<V> |
replaceValues(K key,
java.lang.Iterable<? extends V> values)
Stores a collection of values with the same key, replacing any existing
values for that key.
|
asMap, delegate, put, putAll, putAll
clear, containsEntry, containsKey, containsValue, equals, hashCode, isEmpty, keys, keySet, remove, size, values
toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asMap, equals
clear, containsEntry, containsKey, containsValue, hashCode, isEmpty, keys, keySet, put, putAll, putAll, remove, size, values
ConstrainedSetMultimap(SetMultimap<K,V> delegate, MapConstraint<? super K,? super V> constraint)
public java.util.Set<V> get(K key)
Multimap
key
in this
multimap, if any. Note that when containsKey(key)
is false, this
returns an empty collection, not null
.
Changes to the returned collection will update the underlying multimap, and vice versa.
public java.util.Set<java.util.Map.Entry<K,V>> entries()
Multimap
Map.Entry
instances.
Changes to the returned collection or the entries it contains will update the underlying multimap, and vice versa. However, adding to the returned collection is not possible.
public java.util.Set<V> removeAll(java.lang.Object key)
Multimap
key
.
Once this method returns, key
will not be mapped to any values,
so it will not appear in Multimap.keySet()
, Multimap.asMap()
, or any other
views.
removeAll
in interface Multimap<K,V>
removeAll
in interface SetMultimap<K,V>
removeAll
in class ForwardingMultimap<K,V>
public java.util.Set<V> replaceValues(K key, java.lang.Iterable<? extends V> values)
Multimap
If values
is empty, this is equivalent to
removeAll(key)
.
replaceValues
in interface Multimap<K,V>
replaceValues
in interface SetMultimap<K,V>
replaceValues
in class MapConstraints.ConstrainedMultimap<K,V>