@GwtCompatible class FilteredKeyMultimap<K,V> extends AbstractMultimap<K,V> implements FilteredMultimap<K,V>
Multimaps.filterKeys(Multimap, Predicate)
.Modifier and Type | Class and Description |
---|---|
(package private) static class |
FilteredKeyMultimap.AddRejectingList<K,V> |
(package private) static class |
FilteredKeyMultimap.AddRejectingSet<K,V> |
(package private) class |
FilteredKeyMultimap.Entries |
AbstractMultimap.EntrySet, AbstractMultimap.Values
Modifier and Type | Field and Description |
---|---|
(package private) Predicate<? super K> |
keyPredicate |
(package private) Multimap<K,V> |
unfiltered |
Constructor and Description |
---|
FilteredKeyMultimap(Multimap<K,V> unfiltered,
Predicate<? super K> keyPredicate) |
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<V>> |
createAsMap() |
(package private) java.util.Collection<java.util.Map.Entry<K,V>> |
createEntries() |
(package private) Multiset<K> |
createKeys() |
(package private) java.util.Set<K> |
createKeySet() |
(package private) java.util.Collection<V> |
createValues() |
(package private) java.util.Iterator<java.util.Map.Entry<K,V>> |
entryIterator() |
Predicate<? super java.util.Map.Entry<K,V>> |
entryPredicate() |
java.util.Collection<V> |
get(K key)
Returns a view collection of the values associated with
key in this multimap, if any. |
java.util.Collection<V> |
removeAll(java.lang.Object key)
Removes all values associated with the key
key . |
int |
size()
Returns the number of key-value pairs in this multimap.
|
Multimap<K,V> |
unfiltered() |
(package private) java.util.Collection<V> |
unmodifiableEmptyCollection() |
asMap, containsEntry, containsValue, entries, entrySpliterator, equals, hashCode, isEmpty, keys, keySet, put, putAll, putAll, remove, replaceValues, toString, valueIterator, values, valueSpliterator
public Multimap<K,V> unfiltered()
unfiltered
in interface FilteredMultimap<K,V>
public Predicate<? super java.util.Map.Entry<K,V>> entryPredicate()
entryPredicate
in interface FilteredMultimap<K,V>
public int size()
Multimap
Note: 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.
public boolean containsKey(java.lang.Object key)
Multimap
true
if this multimap contains at least one key-value pair with the key key
.containsKey
in interface Multimap<K,V>
public java.util.Collection<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.
java.util.Collection<V> unmodifiableEmptyCollection()
public void clear()
Multimap
java.util.Set<K> createKeySet()
createKeySet
in class AbstractMultimap<K,V>
public java.util.Collection<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.
java.util.Iterator<java.util.Map.Entry<K,V>> entryIterator()
entryIterator
in class AbstractMultimap<K,V>
java.util.Collection<java.util.Map.Entry<K,V>> createEntries()
createEntries
in class AbstractMultimap<K,V>
java.util.Collection<V> createValues()
createValues
in class AbstractMultimap<K,V>
java.util.Map<K,java.util.Collection<V>> createAsMap()
createAsMap
in class AbstractMultimap<K,V>
Multiset<K> createKeys()
createKeys
in class AbstractMultimap<K,V>