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

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

extends AbstractSetMultimap<K extends @Nullable Object, V extends @Nullable Object>
implements SortedSetMultimap<K extends @Nullable Object, V extends @Nullable Object>
Class Inheritance
All Implemented Interfaces
com.google.common.collect.SortedSetMultimap, com.google.common.collect.SetMultimap, com.google.common.collect.Multimap
Known Direct Subclasses
com.google.common.collect.Multimaps.CustomSortedSetMultimap, com.google.common.collect.AbstractSortedKeySortedSetMultimap
Annotations
@GwtCompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtCompatible, com.google.errorprone.annotations.CanIgnoreReturnValue, java.util.Collection, .Collections, .Map, .NavigableSet, .SortedSet, javax.annotation.CheckForNull, org.checkerframework.checker.nullness.qual.Nullable

Basic implementation of the SortedSetMultimap interface. It's a wrapper around AbstractMapBasedMultimap that converts the returned collections into sorted sets. The createCollection method must return a SortedSet.
Author
Jared Levy

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
protected
AbstractSortedSetMultimap(Map<K, Collection<V>>
place to store the mapping from each key to its corresponding values
map
)

Creates a new multimap that uses the provided map.

Method Summary

Modifier and TypeMethod and Description
public Map<K, Collection<V>>
pack-priv abstract SortedSet<V>
createCollection()

Implements abstract com.google.common.collect.AbstractSetMultimap.createCollection.

Creates the collection of values for a single key.
pack-priv SortedSet<V>
public SortedSet<V>
public SortedSet<V>
public SortedSet<V>
pack-priv <E extends @Nullable Object> SortedSet<E>
public Collection<V>
values()

Overrides com.google.common.collect.AbstractMapBasedMultimap.values.

Implements com.google.common.collect.Multimap.values.

Returns a view collection containing the value from each key-value pair contained in this multimap, without collapsing duplicates (so values().size() == size()).
pack-priv Collection<V>
wrapCollection(K key, Collection<V> collection)

Overrides com.google.common.collect.AbstractSetMultimap.wrapCollection.

Generates a decorated collection that remains consistent with the values in the multimap for the provided key.
Inherited from com.google.common.collect.AbstractSetMultimap:
entriesequalsput

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.google.common.collect.AbstractSetMultimap.serialVersionUID.

Constructor Detail

AbstractSortedSetMultimapback to summary
protected AbstractSortedSetMultimap(Map<K, Collection<V>> map)

Creates a new multimap that uses the provided map.

Parameters
map:Map<K, Collection<V>>

place to store the mapping from each key to its corresponding values

Method Detail

asMapback to summary
public Map<K, Collection<V>> asMap()

Overrides com.google.common.collect.AbstractSetMultimap.asMap.

Implements com.google.common.collect.SortedSetMultimap.asMap, com.google.common.collect.SetMultimap.asMap, com.google.common.collect.Multimap.asMap.

Returns a map view that associates each key with the corresponding values in the multimap. Changes to the returned map, such as element removal, will update the underlying multimap. The map does not support setValue on its entries, put, or putAll.

When passed a key that is present in the map, asMap().get(Object) has the same behavior as get, returning a live collection. When passed a key that is not present, however, asMap().get(Object) returns null instead of an empty collection.

Though the method signature doesn't say so explicitly, the returned map has SortedSet values.

Annotations
@Override
createCollectionback to summary
pack-priv abstract SortedSet<V> createCollection()

Implements abstract com.google.common.collect.AbstractSetMultimap.createCollection.

Doc from com.google.common.collect.AbstractMapBasedMultimap.createCollection.

Creates the collection of values for a single key.

Collections with weak, soft, or phantom references are not supported. Each call to createCollection should create a new instance.

The returned collection class determines whether duplicate key-value pairs are allowed.

Returns:SortedSet<V>

an empty collection of values

Annotations
@Override
createUnmodifiableEmptyCollectionback to summary
pack-priv SortedSet<V> createUnmodifiableEmptyCollection()

Overrides com.google.common.collect.AbstractSetMultimap.createUnmodifiableEmptyCollection.

Doc from com.google.common.collect.AbstractMapBasedMultimap.createUnmodifiableEmptyCollection.

Creates an unmodifiable, empty collection of values.

This is used in removeAll on an empty key.

Annotations
@Override
getback to summary
public SortedSet<V> get(K key)

Overrides com.google.common.collect.AbstractSetMultimap.get.

Implements com.google.common.collect.SortedSetMultimap.get, com.google.common.collect.SetMultimap.get, com.google.common.collect.Multimap.get.

Returns a collection view of all values associated with a key. If no mappings in the multimap have the provided key, an empty collection is returned.

Changes to the returned collection will update the underlying multimap, and vice versa.

Because a SortedSetMultimap has unique sorted values for a given key, this method returns a SortedSet, instead of the Collection specified in the Multimap interface.

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

Overrides com.google.common.collect.AbstractSetMultimap.removeAll.

Implements com.google.common.collect.SortedSetMultimap.removeAll, com.google.common.collect.SetMultimap.removeAll, com.google.common.collect.Multimap.removeAll.

Removes all values associated with a given key. The returned collection is immutable.

Because a SortedSetMultimap has unique sorted values for a given key, this method returns a SortedSet, instead of the Collection specified in the Multimap interface.

Returns:SortedSet<V>

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

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

Annotations
@CanIgnoreReturnValue
@Override
replaceValuesback to summary
public SortedSet<V> replaceValues(K key, Iterable<? extends V> values)

Overrides com.google.common.collect.AbstractSetMultimap.replaceValues.

Implements com.google.common.collect.SortedSetMultimap.replaceValues, com.google.common.collect.SetMultimap.replaceValues, com.google.common.collect.Multimap.replaceValues.

Stores a collection of values with the same key, replacing any existing values for that key. The returned collection is immutable.

Because a SortedSetMultimap has unique sorted values for a given key, this method returns a SortedSet, instead of the Collection specified in the Multimap interface.

Any duplicates in values will be stored in the multimap once.

Returns:SortedSet<V>

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

the collection of replaced values, or an empty collection if no values were previously associated with the key. The collection may be modifiable, but updating it will have no effect on the multimap.

Annotations
@CanIgnoreReturnValue
@Override
unmodifiableCollectionSubclassback to summary
pack-priv <E extends @Nullable Object> SortedSet<E> unmodifiableCollectionSubclass(Collection<E> collection)

Overrides com.google.common.collect.AbstractSetMultimap.unmodifiableCollectionSubclass.

Annotations
@Override
valuesback to summary
public Collection<V> values()

Overrides com.google.common.collect.AbstractMapBasedMultimap.values.

Implements com.google.common.collect.Multimap.values.

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

Returns a view collection containing the value from each key-value pair contained in this multimap, without collapsing duplicates (so values().size() == size()).

Changes to the returned collection will update the underlying multimap, and vice versa. However, adding to the returned collection is not possible.

Consequently, the values do not follow their natural ordering or the ordering of the value comparator.

Annotations
@Override
wrapCollectionback to summary
pack-priv Collection<V> wrapCollection(K key, Collection<V> collection)

Overrides com.google.common.collect.AbstractSetMultimap.wrapCollection.

Doc from com.google.common.collect.AbstractMapBasedMultimap.wrapCollection.

Generates a decorated collection that remains consistent with the values in the multimap for the provided key. Changes to the multimap may alter the returned collection, and vice versa.

Annotations
@Override