Top Description Inners Fields Constructors Methods
com.google.common.collect

pack-priv Class FilteredEntryMultimap<K extends @Nullable Object, V extends @Nullable Object>

extends AbstractMultimap<K extends @Nullable Object, V extends @Nullable Object>
implements FilteredMultimap<K extends @Nullable Object, V extends @Nullable Object>
Class Inheritance
All Implemented Interfaces
com.google.common.collect.FilteredMultimap, com.google.common.collect.Multimap
Known Direct Subclasses
com.google.common.collect.FilteredEntrySetMultimap
Annotations
@GwtCompatible
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull, .Predicates.in, .Predicates.not, com.google.common.collect.CollectPreconditions.checkNonnegative

Implementation of Multimaps#filterEntries(Multimap, Predicate).
Authors
Jared Levy, Louis Wasserman

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
pack-priv class
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv final Predicate<? super Map.Entry<K, V>>
pack-priv final Multimap<K, V>

Constructor Summary

AccessConstructor and Description
pack-priv
FilteredEntryMultimap(Multimap<K, V> unfiltered, Predicate<? super Map.Entry<K, V>> predicate)

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements com.google.common.collect.Multimap.clear.

Removes all key-value pairs from the multimap, leaving it empty.
public boolean
containsKey(Object key)

Implements com.google.common.collect.Multimap.containsKey.

Returns true if this multimap contains at least one key-value pair with the key key.
pack-priv Map<K, Collection<V>>
pack-priv Collection<Map.Entry<K, V>>
pack-priv Multiset<K>
pack-priv Set<K>
pack-priv Collection<V>
pack-priv Iterator<Map.Entry<K, V>>
public Predicate<? super Map.Entry<K, V>>
pack-priv static <E extends @Nullable Object> Collection<E>
filterCollection(Collection<E> collection, Predicate<? super E> predicate)

public Collection<V>
get(K key)

Implements com.google.common.collect.Multimap.get.

Returns a view collection of the values associated with key in this multimap, if any.
public Collection<V>
removeAll(Object key)

Implements com.google.common.collect.Multimap.removeAll.

Removes all values associated with the key key.
pack-priv boolean
removeEntriesIf(Predicate<? super Map.Entry<K, Collection<V>>> predicate)

private boolean
satisfies(K key, V value)

public int
size()

Implements com.google.common.collect.Multimap.size.

Returns the number of key-value pairs in this multimap.
public Multimap<K, V>
pack-priv Collection<V>
Inherited from com.google.common.collect.AbstractMultimap:
asMapcontainsEntrycontainsValueentriesentrySpliteratorequalshashCodeisEmptykeyskeySetputputAllputAllremovereplaceValuestoStringvalueIteratorvaluesvalueSpliterator

Field Detail

predicateback to summary
pack-priv final Predicate<? super Map.Entry<K, V>> predicate
unfilteredback to summary
pack-priv final Multimap<K, V> unfiltered

Constructor Detail

FilteredEntryMultimapback to summary
pack-priv FilteredEntryMultimap(Multimap<K, V> unfiltered, Predicate<? super Map.Entry<K, V>> predicate)

Method Detail

clearback to summary
public void clear()

Implements com.google.common.collect.Multimap.clear.

Doc from com.google.common.collect.Multimap.clear.

Removes all key-value pairs from the multimap, leaving it empty.

Annotations
@Override
containsKeyback to summary
public boolean containsKey(Object key)

Implements com.google.common.collect.Multimap.containsKey.

Doc from com.google.common.collect.Multimap.containsKey.

Returns true if this multimap contains at least one key-value pair with the key key.

Annotations
@Override
createAsMapback to summary
pack-priv Map<K, Collection<V>> createAsMap()

Implements abstract com.google.common.collect.AbstractMultimap.createAsMap.

Annotations
@Override
createEntriesback to summary
pack-priv Collection<Map.Entry<K, V>> createEntries()

Implements abstract com.google.common.collect.AbstractMultimap.createEntries.

Annotations
@Override
createKeysback to summary
pack-priv Multiset<K> createKeys()

Implements abstract com.google.common.collect.AbstractMultimap.createKeys.

Annotations
@Override
createKeySetback to summary
pack-priv Set<K> createKeySet()

Implements abstract com.google.common.collect.AbstractMultimap.createKeySet.

Annotations
@Override
createValuesback to summary
pack-priv Collection<V> createValues()

Implements abstract com.google.common.collect.AbstractMultimap.createValues.

Annotations
@Override
entryIteratorback to summary
pack-priv Iterator<Map.Entry<K, V>> entryIterator()

Implements abstract com.google.common.collect.AbstractMultimap.entryIterator.

Annotations
@Override
entryPredicateback to summary
public Predicate<? super Map.Entry<K, V>> entryPredicate()

Implements com.google.common.collect.FilteredMultimap.entryPredicate.

Annotations
@Override
filterCollectionback to summary
pack-priv static <E extends @Nullable Object> Collection<E> filterCollection(Collection<E> collection, Predicate<? super E> predicate)
getback to summary
public Collection<V> get(K key)

Implements com.google.common.collect.Multimap.get.

Doc from com.google.common.collect.Multimap.get.

Returns a view collection of the values associated with 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.

Annotations
@Override
removeAllback to summary
public Collection<V> removeAll(Object key)

Implements com.google.common.collect.Multimap.removeAll.

Doc from com.google.common.collect.Multimap.removeAll.

Removes all values associated with the key key.

Once this method returns, key will not be mapped to any values, so it will not appear in keySet(), asMap(), or any other views.

Returns:Collection<V>

the values that were removed (possibly empty). The returned collection may be modifiable, but updating it will have no effect on the multimap.

Annotations
@Override
removeEntriesIfback to summary
pack-priv boolean removeEntriesIf(Predicate<? super Map.Entry<K, Collection<V>>> predicate)
satisfiesback to summary
private boolean satisfies(K key, V value)
sizeback to summary
public int size()

Implements com.google.common.collect.Multimap.size.

Doc from com.google.common.collect.Multimap.size.

Returns the number of key-value pairs in this 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.

Annotations
@Override
unfilteredback to summary
public Multimap<K, V> unfiltered()

Implements com.google.common.collect.FilteredMultimap.unfiltered.

Annotations
@Override
unmodifiableEmptyCollectionback to summary
pack-priv Collection<V> unmodifiableEmptyCollection()
com.google.common.collect back to summary

pack-priv Class FilteredEntryMultimap.AsMap

extends Maps.ViewCachingAbstractMap<K extends @Nullable Object, Collection<V extends @Nullable Object>>
Class Inheritance
Annotations
@WeakOuter

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.AbstractMap.clear.

Implements java.util.Map.clear.

Removes all of the mappings from this map (optional operation).
public boolean
containsKey(Object
key whose presence in this map is to be tested
key
)

Overrides java.util.AbstractMap.containsKey.

Implements java.util.Map.containsKey.

Returns true if this map contains a mapping for the specified key.
pack-priv Set<Map.Entry<K, Collection<V>>>
createEntrySet()

Implements abstract com.google.common.collect.Maps.ViewCachingAbstractMap.createEntrySet.

Creates the entry set to be returned by entrySet().
pack-priv Set<K>
pack-priv Collection<Collection<V>>
public Collection<V>
get(Object
the key whose associated value is to be returned
key
)

Overrides java.util.AbstractMap.get.

Implements java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
public Collection<V>
remove(Object
key whose mapping is to be removed from the map
key
)

Overrides java.util.AbstractMap.remove.

Implements java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation).
Inherited from com.google.common.collect.Maps.ViewCachingAbstractMap:
entrySetkeySetvalues

Constructor Detail

AsMapback to summary
pack-priv AsMap()

Method Detail

clearback to summary
public void clear()

Overrides java.util.AbstractMap.clear.

Implements java.util.Map.clear.

Doc from java.util.AbstractMap.clear.

Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.

Annotations
@Override
containsKeyback to summary
public boolean containsKey(Object key)

Overrides java.util.AbstractMap.containsKey.

Implements java.util.Map.containsKey.

Doc from java.util.AbstractMap.containsKey.

Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that Objects.equals(key, k). (There can be at most one such mapping.)

Parameters
key:Object

Doc from java.util.Map.containsKey.

key whose presence in this map is to be tested

Returns:boolean

Doc from java.util.Map.containsKey.

true if this map contains a mapping for the specified key

Annotations
@Override
createEntrySetback to summary
pack-priv Set<Map.Entry<K, Collection<V>>> createEntrySet()

Implements abstract com.google.common.collect.Maps.ViewCachingAbstractMap.createEntrySet.

Doc from com.google.common.collect.Maps.ViewCachingAbstractMap.createEntrySet.

Creates the entry set to be returned by entrySet(). This method is invoked at most once on a given map, at the time when entrySet is first called.

Annotations
@Override
createKeySetback to summary
pack-priv Set<K> createKeySet()

Overrides com.google.common.collect.Maps.ViewCachingAbstractMap.createKeySet.

Annotations
@Override
createValuesback to summary
pack-priv Collection<Collection<V>> createValues()

Overrides com.google.common.collect.Maps.ViewCachingAbstractMap.createValues.

Annotations
@Override
getback to summary
public Collection<V> get(Object key)

Overrides java.util.AbstractMap.get.

Implements java.util.Map.get.

Doc from java.util.AbstractMap.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

More formally, if this map contains a mapping from a key k to a value v such that Objects.equals(key, k), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

If this map permits null values, then a return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

Parameters
key:Object

Doc from java.util.Map.get.

the key whose associated value is to be returned

Returns:Collection<V>

Doc from java.util.Map.get.

the value to which the specified key is mapped, or null if this map contains no mapping for the key

Annotations
@Override
@CheckForNull
removeback to summary
public Collection<V> remove(Object key)

Overrides java.util.AbstractMap.remove.

Implements java.util.Map.remove.

Doc from java.util.AbstractMap.remove.

Removes the mapping for a key from this map if it is present (optional operation). More formally, if this map contains a mapping from key k to value v such that Objects.equals(key, k), that mapping is removed. (The map can contain at most one such mapping.)

Returns the value to which this map previously associated the key, or null if the map contained no mapping for the key.

If this map permits null values, then a return value of null does not necessarily indicate that the map contained no mapping for the key; it's also possible that the map explicitly mapped the key to null.

The map will not contain a mapping for the specified key once the call returns.

Parameters
key:Object

Doc from java.util.Map.remove.

key whose mapping is to be removed from the map

Returns:Collection<V>

Doc from java.util.Map.remove.

the previous value associated with key, or null if there was no mapping for key.

Annotations
@Override
@CheckForNull
com.google.common.collect back to summary

pack-priv Class FilteredEntryMultimap.Keys

extends Multimaps.Keys<K extends @Nullable Object, V extends @Nullable Object>
Class Inheritance
Annotations
@WeakOuter

Field Summary

Inherited from com.google.common.collect.Multimaps.Keys:
multimap

Constructor Summary

AccessConstructor and Description
pack-priv
Keys()

Method Summary

Modifier and TypeMethod and Description
public Set<Multiset.Entry<K>>
entrySet()

Overrides com.google.common.collect.AbstractMultiset.entrySet.

Implements com.google.common.collect.Multiset.entrySet.

Returns a view of the contents of this multiset, grouped into Multiset.Entry instances, each providing an element of the multiset and the count of that element.
public int
remove(Object
the element to conditionally remove occurrences of
key
,
int
the number of occurrences of the element to remove. May be zero, in which case no change will be made.
occurrences
)

Overrides com.google.common.collect.Multimaps.Keys.remove.

Implements com.google.common.collect.Multiset.remove.

Removes a number of occurrences of the specified element from this multiset.
Inherited from com.google.common.collect.Multimaps.Keys:
clearcontainscountdistinctElementselementIteratorelementSetentryIteratorforEachiteratorsizespliterator

Constructor Detail

Keysback to summary
pack-priv Keys()

Method Detail

entrySetback to summary
public Set<Multiset.Entry<K>> entrySet()

Overrides com.google.common.collect.AbstractMultiset.entrySet.

Implements com.google.common.collect.Multiset.entrySet.

Doc from com.google.common.collect.Multiset.entrySet.

Returns a view of the contents of this multiset, grouped into Multiset.Entry instances, each providing an element of the multiset and the count of that element. This set contains exactly one entry for each distinct element in the multiset (thus it always has the same size as the elementSet). The order of the elements in the element set is unspecified.

The entry set is backed by the same data as the multiset, so any change to either is immediately reflected in the other. However, multiset changes may or may not be reflected in any Entry instances already retrieved from the entry set (this is implementation-dependent). Furthermore, implementations are not required to support modifications to the entry set at all, and the Entry instances themselves don't even have methods for modification. See the specific implementation class for more details on how its entry set handles modifications.

Returns:Set<Multiset.Entry<K>>

a set of entries representing the data of this multiset

Annotations
@Override
removeback to summary
public int remove(Object key, int occurrences)

Overrides com.google.common.collect.Multimaps.Keys.remove.

Implements com.google.common.collect.Multiset.remove.

Doc from com.google.common.collect.Multiset.remove.

Removes a number of occurrences of the specified element from this multiset. If the multiset contains fewer than this number of occurrences to begin with, all occurrences will be removed. Note that if occurrences == 1, this is functionally equivalent to the call remove(element).

Parameters
key:Object

the element to conditionally remove occurrences of

occurrences:int

the number of occurrences of the element to remove. May be zero, in which case no change will be made.

Returns:int

the count of the element before the operation; possibly zero

Annotations
@Override
com.google.common.collect back to summary

pack-priv final Class FilteredEntryMultimap.ValuePredicate

extends Object
implements Predicate<V extends @Nullable Object>
Class Inheritance
  • java.lang.Object
  • com.google.common.collect.FilteredEntryMultimap.ValuePredicate
All Implemented Interfaces
com.google.common.base.Predicate, java.util.function.Predicate

Field Summary

Modifier and TypeField and Description
private final K

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
apply(V value)

Implements com.google.common.base.Predicate.apply.

Returns the result of applying this predicate to input (Java 8 users, see notes in the class documentation above).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keyback to summary
private final K key
Annotations
@ParametricNullness

Constructor Detail

ValuePredicateback to summary
pack-priv ValuePredicate(K key)

Method Detail

applyback to summary
public boolean apply(V value)

Implements com.google.common.base.Predicate.apply.

Doc from com.google.common.base.Predicate.apply.

Returns the result of applying this predicate to input (Java 8 users, see notes in the class documentation above). This method is generally expected, but not absolutely required, to have the following properties:

  • Its execution does not cause any observable side effects.
  • The computation is consistent with equals; that is, Objects.equal(a, b) implies that predicate.apply(a) == predicate.apply(b)).
Annotations
@Override