@GwtCompatible public abstract class ForwardingListMultimap<K,V> extends ForwardingMultimap<K,V> implements ListMultimap<K,V>
default
method warning: This class does not forward calls to default
methods. Instead, it inherits their default implementations. When those implementations
invoke methods, they invoke methods on the ForwardingListMultimap
.
Modifier | Constructor and Description |
---|---|
protected |
ForwardingListMultimap()
Constructor for use by subclasses.
|
Modifier and Type | Method and Description |
---|---|
protected abstract ListMultimap<K,V> |
delegate()
Returns the backing delegate instance that methods are forwarded to.
|
List<V> |
get(K key)
Returns a view collection of the values associated with
key in this multimap, if any. |
List<V> |
removeAll(@Nullable Object key)
Removes all values associated with the key
key . |
List<V> |
replaceValues(K key,
Iterable<? extends V> values)
Stores a collection of values with the same key, replacing any existing values for that key.
|
asMap, clear, containsEntry, containsKey, containsValue, entries, equals, hashCode, isEmpty, keys, keySet, put, putAll, putAll, remove, size, values
toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asMap, equals
protected ForwardingListMultimap()
protected abstract ListMultimap<K,V> delegate()
ForwardingObject
ForwardingSet.delegate()
. Concrete subclasses override this method to supply the
instance being decorated.delegate
in class ForwardingMultimap<K,V>
public List<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.
@CanIgnoreReturnValue public List<V> removeAll(@Nullable 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 ListMultimap<K,V>
removeAll
in interface Multimap<K,V>
removeAll
in class ForwardingMultimap<K,V>
@CanIgnoreReturnValue public List<V> replaceValues(K key, Iterable<? extends V> values)
Multimap
If values
is empty, this is equivalent to removeAll(key)
.
replaceValues
in interface ListMultimap<K,V>
replaceValues
in interface Multimap<K,V>
replaceValues
in class ForwardingMultimap<K,V>
Copyright © 2010–2020. All rights reserved.