private static class Multimaps.TransformedEntriesMultimap<K,V1,V2> extends AbstractMultimap<K,V2>
AbstractMultimap.Values| Modifier and Type | Field and Description |
|---|---|
(package private) Multimap<K,V1> |
fromMultimap |
(package private) Maps.EntryTransformer<? super K,? super V1,V2> |
transformer |
| Constructor and Description |
|---|
TransformedEntriesMultimap(Multimap<K,V1> fromMultimap,
Maps.EntryTransformer<? super K,? super V1,V2> transformer) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all key-value pairs from the multimap, leaving it empty.
|
boolean |
containsKey(java.lang.Object key)
Returns
true if this multimap contains at least one key-value pair
with the key key. |
(package private) java.util.Map<K,java.util.Collection<V2>> |
createAsMap() |
(package private) java.util.Collection<V2> |
createValues() |
(package private) java.util.Iterator<java.util.Map.Entry<K,V2>> |
entryIterator() |
java.util.Collection<V2> |
get(K key)
Returns a view collection of the values associated with
key in this
multimap, if any. |
boolean |
isEmpty()
Returns
true if this multimap contains no key-value pairs. |
Multiset<K> |
keys()
Returns a view collection containing the key from each key-value pair in
this multimap, without collapsing duplicates.
|
java.util.Set<K> |
keySet()
Returns a view collection of all distinct keys contained in this
multimap.
|
boolean |
put(K key,
V2 value)
Stores a key-value pair in this multimap.
|
boolean |
putAll(K key,
java.lang.Iterable<? extends V2> values)
Stores a key-value pair in this multimap for each of
values, all
using the same key, key. |
boolean |
putAll(Multimap<? extends K,? extends V2> multimap)
Stores all key-value pairs of
multimap in this multimap, in the
order returned by multimap.entries(). |
boolean |
remove(java.lang.Object key,
java.lang.Object value)
Removes a single key-value pair with the key
key and the value
value from this multimap, if such exists. |
java.util.Collection<V2> |
removeAll(java.lang.Object key)
Removes all values associated with the key
key. |
java.util.Collection<V2> |
replaceValues(K key,
java.lang.Iterable<? extends V2> values)
Stores a collection of values with the same key, replacing any existing
values for that key.
|
int |
size()
Returns the number of key-value pairs in this multimap.
|
(package private) java.util.Collection<V2> |
transform(K key,
java.util.Collection<V1> values) |
asMap, containsEntry, containsValue, createEntries, createKeys, createKeySet, entries, equals, hashCode, toString, valueIterator, valuesfinal Maps.EntryTransformer<? super K,? super V1,V2> transformer
java.util.Map<K,java.util.Collection<V2>> createAsMap()
createAsMap in class AbstractMultimap<K,V2>public void clear()
Multimappublic boolean containsKey(java.lang.Object key)
Multimaptrue if this multimap contains at least one key-value pair
with the key key.java.util.Iterator<java.util.Map.Entry<K,V2>> entryIterator()
entryIterator in class AbstractMultimap<K,V2>public java.util.Collection<V2> get(K key)
Multimapkey 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 boolean isEmpty()
Multimaptrue if this multimap contains no key-value pairs.
Equivalent to size() == 0, but can in some cases be more efficient.public java.util.Set<K> keySet()
MultimapChanges to the returned set will update the underlying multimap, and vice versa. However, adding to the returned set is not possible.
public Multiset<K> keys()
Multimapkeys().count(k) ==
get(k).size() for all k.
Changes to the returned multiset will update the underlying multimap, and vice versa. However, adding to the returned collection is not possible.
public boolean put(K key, V2 value)
MultimapSome multimap implementations allow duplicate key-value pairs, in which
case put always adds a new key-value pair and increases the
multimap size by 1. Other implementations prohibit duplicates, and storing
a key-value pair that's already in the multimap has no effect.
public boolean putAll(K key, java.lang.Iterable<? extends V2> values)
Multimapvalues, all
using the same key, key. Equivalent to (but expected to be more
efficient than):
for (V value : values) {
put(key, value);
}
In particular, this is a no-op if values is empty.
public boolean putAll(Multimap<? extends K,? extends V2> multimap)
Multimapmultimap in this multimap, in the
order returned by multimap.entries().public boolean remove(java.lang.Object key,
java.lang.Object value)
Multimapkey and the value
value from this multimap, if such exists. If multiple key-value
pairs in the multimap fit this description, which one is removed is
unspecified.public java.util.Collection<V2> removeAll(java.lang.Object key)
Multimapkey.
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.
public java.util.Collection<V2> replaceValues(K key, java.lang.Iterable<? extends V2> values)
MultimapIf values is empty, this is equivalent to
removeAll(key).
replaceValues in interface Multimap<K,V2>replaceValues in class AbstractMultimap<K,V2>public int size()
MultimapNote: this method does not return the number of distinct
keys in the multimap, which is given by keySet().size() or
asMap().size(). See the opening section of the Multimap
class documentation for clarification.
java.util.Collection<V2> createValues()
createValues in class AbstractMultimap<K,V2>