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

public Class ImmutableSetMultimap<K, V>

extends ImmutableMultimap<K, V>
implements SetMultimap<K, V>
Class Inheritance
All Implemented Interfaces
com.google.common.collect.SetMultimap, com.google.common.collect.Multimap
Known Direct Subclasses
com.google.common.collect.EmptyImmutableSetMultimap
Annotations
@GwtCompatible
serializable:true
emulated:true
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull

A SetMultimap whose contents will never change, with many other important properties detailed at ImmutableCollection.

Warning

As in all SetMultimaps, do not modify either a key or a value of a ImmutableSetMultimap in a way that affects its Object#equals behavior. Undefined behavior and bugs will result.

See the Guava User Guide article on immutable collections.

Author
Mike Ward
Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ImmutableSetMultimap.Builder<K, V>

A builder for creating immutable SetMultimap instances, especially public static final multimaps ("constant multimaps").

private static class
private static class

Field Summary

Modifier and TypeField and Description
private final transient ImmutableSet<V>
emptySet

Returned by get() when a missing key is provided.

private transient ImmutableSet<Map.Entry<K, V>>
private transient ImmutableSetMultimap<V, K>
private static final long
Inherited from com.google.common.collect.ImmutableMultimap:
mapsize

Constructor Summary

AccessConstructor and Description
pack-priv
ImmutableSetMultimap(ImmutableMap<K, ImmutableSet<V>> map, int size, Comparator<? super V> valueComparator)

Method Summary

Modifier and TypeMethod and Description
public static <K, V> ImmutableSetMultimap.Builder<K, V>
public static <K, V> ImmutableSetMultimap<K, V>
copyOf(Multimap<? extends K, ? extends V> multimap)

Hides com.google.common.collect.ImmutableMultimap.copyOf.

Returns an immutable set multimap containing the same mappings as multimap.
private static <K, V> ImmutableSetMultimap<K, V>
copyOf(Multimap<? extends K, ? extends V> multimap, Comparator<? super V> valueComparator)

public static <K, V> ImmutableSetMultimap<K, V>
copyOf(Iterable<? extends Map.Entry<? extends K, ? extends V>> entries)

Hides com.google.common.collect.ImmutableMultimap.copyOf.

Returns an immutable multimap containing the specified entries.
private static <V> ImmutableSet<V>
emptySet(Comparator<? super V> valueComparator)

public ImmutableSet<Map.Entry<K, V>>
entries()

Overrides com.google.common.collect.ImmutableMultimap.entries.

Implements com.google.common.collect.SetMultimap.entries, com.google.common.collect.Multimap.entries.

Returns an immutable collection of all key-value pairs in the multimap.
public static <T extends @Nullable Object, K, V> Collector<T, ?, ImmutableSetMultimap<K, V>>
flatteningToImmutableSetMultimap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends Stream<? extends V>> valuesFunction)

Returns a Collector accumulating entries into an ImmutableSetMultimap.

pack-priv static <K, V> ImmutableSetMultimap<K, V>
fromMapEntries(Collection<? extends Map.Entry<? extends K, ? extends Collection<? extends V>>> mapEntries, Comparator<? super V> valueComparator)

Creates an ImmutableSetMultimap from an asMap.entrySet.

public ImmutableSet<V>
get(K key)

Implements abstract com.google.common.collect.ImmutableMultimap.get.

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

Returns an immutable set of the values for the given key.
public ImmutableSetMultimap<V, K>
inverse()

Implements abstract com.google.common.collect.ImmutableMultimap.inverse.

Returns an immutable multimap which is the inverse of this one.
private ImmutableSetMultimap<V, K>
public static <K, V> ImmutableSetMultimap<K, V>
of()

Hides com.google.common.collect.ImmutableMultimap.of.

Returns the empty multimap.
public static <K, V> ImmutableSetMultimap<K, V>
of(K k1, V v1)

Hides com.google.common.collect.ImmutableMultimap.of.

Returns an immutable multimap containing a single entry.
public static <K, V> ImmutableSetMultimap<K, V>
of(K k1, V v1, K k2, V v2)

Hides com.google.common.collect.ImmutableMultimap.of.

Returns an immutable multimap containing the given entries, in order.
public static <K, V> ImmutableSetMultimap<K, V>
of(K k1, V v1, K k2, V v2, K k3, V v3)

Hides com.google.common.collect.ImmutableMultimap.of.

Returns an immutable multimap containing the given entries, in order.
public static <K, V> ImmutableSetMultimap<K, V>
of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)

Hides com.google.common.collect.ImmutableMultimap.of.

Returns an immutable multimap containing the given entries, in order.
public static <K, V> ImmutableSetMultimap<K, V>
of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)

Hides com.google.common.collect.ImmutableMultimap.of.

Returns an immutable multimap containing the given entries, in order.
private void
public final ImmutableSet<V>
removeAll(Object key)

Overrides com.google.common.collect.ImmutableMultimap.removeAll.

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

Deprecated Unsupported operation.
Guaranteed to throw an exception and leave the multimap unmodified.
public final ImmutableSet<V>
replaceValues(K key, Iterable<? extends V> values)

Overrides com.google.common.collect.ImmutableMultimap.replaceValues.

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

Deprecated Unsupported operation.
Guaranteed to throw an exception and leave the multimap unmodified.
public static <T extends @Nullable Object, K, V> Collector<T, ?, ImmutableSetMultimap<K, V>>
toImmutableSetMultimap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)

Returns a Collector that accumulates elements into an ImmutableSetMultimap whose keys and values are the result of applying the provided mapping functions to the input elements.

pack-priv Comparator<? super V>
private static <V> ImmutableSet.Builder<V>
valuesBuilder(Comparator<? super V> valueComparator)

private static <V> ImmutableSet<V>
valueSet(Comparator<? super V> valueComparator, Collection<? extends V> values)

private void
Inherited from com.google.common.collect.ImmutableMultimap:
asMapclearcontainsKeycontainsValuecreateAsMapcreateEntriescreateKeyscreateKeySetcreateValuesentryIteratorentrySpliteratorforEachisPartialViewkeyskeySetputputAllputAllremovesizevalueIteratorvalues

Field Detail

emptySetback to summary
private final transient ImmutableSet<V> emptySet

Returned by get() when a missing key is provided. Also holds the comparator, if any, used for values.

entriesback to summary
private transient ImmutableSet<Map.Entry<K, V>> entries

Hides com.google.common.collect.AbstractMultimap.entries.

Annotations
@LazyInit
@RetainedWith
@CheckForNull
inverseback to summary
private transient ImmutableSetMultimap<V, K> inverse
Annotations
@LazyInit
@RetainedWith
@CheckForNull
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.google.common.collect.ImmutableMultimap.serialVersionUID.

Annotations
@GwtIncompatible
@J2ktIncompatible

Constructor Detail

ImmutableSetMultimapback to summary
pack-priv ImmutableSetMultimap(ImmutableMap<K, ImmutableSet<V>> map, int size, Comparator<? super V> valueComparator)

Method Detail

builderback to summary
public static <K, V> ImmutableSetMultimap.Builder<K, V> builder()

Hides com.google.common.collect.ImmutableMultimap.builder.

Returns a new Builder.

copyOfback to summary
public static <K, V> ImmutableSetMultimap<K, V> copyOf(Multimap<? extends K, ? extends V> multimap)

Hides com.google.common.collect.ImmutableMultimap.copyOf.

Returns an immutable set multimap containing the same mappings as multimap. The generated multimap's key and value orderings correspond to the iteration ordering of the multimap.asMap() view. Repeated occurrences of an entry in the multimap after the first are ignored.

Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change.

Exceptions
NullPointerException:
if any key or value in multimap is null
copyOfback to summary
private static <K, V> ImmutableSetMultimap<K, V> copyOf(Multimap<? extends K, ? extends V> multimap, Comparator<? super V> valueComparator)
copyOfback to summary
public static <K, V> ImmutableSetMultimap<K, V> copyOf(Iterable<? extends Map.Entry<? extends K, ? extends V>> entries)

Hides com.google.common.collect.ImmutableMultimap.copyOf.

Returns an immutable multimap containing the specified entries. The returned multimap iterates over keys in the order they were first encountered in the input, and the values for each key are iterated in the order they were encountered. If two values for the same key are equal, the first value encountered is used.

Exceptions
NullPointerException:
if any key, value, or entry is null
Since
19.0
emptySetback to summary
private static <V> ImmutableSet<V> emptySet(Comparator<? super V> valueComparator)
entriesback to summary
public ImmutableSet<Map.Entry<K, V>> entries()

Overrides com.google.common.collect.ImmutableMultimap.entries.

Implements com.google.common.collect.SetMultimap.entries, com.google.common.collect.Multimap.entries.

Returns an immutable collection of all key-value pairs in the multimap. Its iterator traverses the values for the first key, the values for the second key, and so on.

Annotations
@Override
flatteningToImmutableSetMultimapback to summary
public static <T extends @Nullable Object, K, V> Collector<T, ?, ImmutableSetMultimap<K, V>> flatteningToImmutableSetMultimap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends Stream<? extends V>> valuesFunction)

Returns a Collector accumulating entries into an ImmutableSetMultimap. Each input element is mapped to a key and a stream of values, each of which are put into the resulting Multimap, in the encounter order of the stream and the encounter order of the streams of values.

Example:

static final ImmutableSetMultimap<Character, Character> FIRST_LETTER_MULTIMAP =
    Stream.of("banana", "apple", "carrot", "asparagus", "cherry")
        .collect(
            flatteningToImmutableSetMultimap(
                 str -> str.charAt(0),
                 str -> str.substring(1).chars().mapToObj(c -> (char) c));

// is equivalent to

static final ImmutableSetMultimap<Character, Character> FIRST_LETTER_MULTIMAP =
    ImmutableSetMultimap.<Character, Character>builder()
        .putAll('b', Arrays.asList('a', 'n', 'a', 'n', 'a'))
        .putAll('a', Arrays.asList('p', 'p', 'l', 'e'))
        .putAll('c', Arrays.asList('a', 'r', 'r', 'o', 't'))
        .putAll('a', Arrays.asList('s', 'p', 'a', 'r', 'a', 'g', 'u', 's'))
        .putAll('c', Arrays.asList('h', 'e', 'r', 'r', 'y'))
        .build();

// after deduplication, the resulting multimap is equivalent to

static final ImmutableSetMultimap<Character, Character> FIRST_LETTER_MULTIMAP =
    ImmutableSetMultimap.<Character, Character>builder()
        .putAll('b', Arrays.asList('a', 'n'))
        .putAll('a', Arrays.asList('p', 'l', 'e', 's', 'a', 'r', 'g', 'u'))
        .putAll('c', Arrays.asList('a', 'r', 'o', 't', 'h', 'e', 'y'))
        .build();

}
Since
21.0
fromMapEntriesback to summary
pack-priv static <K, V> ImmutableSetMultimap<K, V> fromMapEntries(Collection<? extends Map.Entry<? extends K, ? extends Collection<? extends V>>> mapEntries, Comparator<? super V> valueComparator)

Creates an ImmutableSetMultimap from an asMap.entrySet.

getback to summary
public ImmutableSet<V> get(K key)

Implements abstract com.google.common.collect.ImmutableMultimap.get.

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

Returns an immutable set of the values for the given key. If no mappings in the multimap have the provided key, an empty immutable set is returned. The values are in the same order as the parameters used to build this multimap.

Annotations
@Override
inverseback to summary
public ImmutableSetMultimap<V, K> inverse()

Implements abstract com.google.common.collect.ImmutableMultimap.inverse.

Doc from com.google.common.collect.ImmutableMultimap.inverse.

Returns an immutable multimap which is the inverse of this one. For every key-value mapping in the original, the result will have a mapping with key and value reversed.

Because an inverse of a set multimap cannot contain multiple pairs with the same key and value, this method returns an ImmutableSetMultimap rather than the ImmutableMultimap specified in the ImmutableMultimap class.

Annotations
@Override
invertback to summary
private ImmutableSetMultimap<V, K> invert()
ofback to summary
public static <K, V> ImmutableSetMultimap<K, V> of()

Hides com.google.common.collect.ImmutableMultimap.of.

Returns the empty multimap.

Performance note: the instance returned is a singleton.

Annotations
@SuppressWarnings:unchecked
ofback to summary
public static <K, V> ImmutableSetMultimap<K, V> of(K k1, V v1)

Hides com.google.common.collect.ImmutableMultimap.of.

Returns an immutable multimap containing a single entry.

ofback to summary
public static <K, V> ImmutableSetMultimap<K, V> of(K k1, V v1, K k2, V v2)

Hides com.google.common.collect.ImmutableMultimap.of.

Returns an immutable multimap containing the given entries, in order. Repeated occurrences of an entry (according to Object#equals) after the first are ignored.

ofback to summary
public static <K, V> ImmutableSetMultimap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3)

Hides com.google.common.collect.ImmutableMultimap.of.

Returns an immutable multimap containing the given entries, in order. Repeated occurrences of an entry (according to Object#equals) after the first are ignored.

ofback to summary
public static <K, V> ImmutableSetMultimap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)

Hides com.google.common.collect.ImmutableMultimap.of.

Returns an immutable multimap containing the given entries, in order. Repeated occurrences of an entry (according to Object#equals) after the first are ignored.

ofback to summary
public static <K, V> ImmutableSetMultimap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)

Hides com.google.common.collect.ImmutableMultimap.of.

Returns an immutable multimap containing the given entries, in order. Repeated occurrences of an entry (according to Object#equals) after the first are ignored.

readObjectback to summary
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
Annotations
@GwtIncompatible
@J2ktIncompatible
@SuppressWarnings:unchecked
removeAllback to summary
public final ImmutableSet<V> removeAll(Object key)

Overrides com.google.common.collect.ImmutableMultimap.removeAll.

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

Deprecated

Unsupported operation.

Guaranteed to throw an exception and leave the multimap unmodified.

Returns:ImmutableSet<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
@Deprecated
@Override
@DoNotCall:Always throws UnsupportedOperationException
Exceptions
UnsupportedOperationException:
always
replaceValuesback to summary
public final ImmutableSet<V> replaceValues(K key, Iterable<? extends V> values)

Overrides com.google.common.collect.ImmutableMultimap.replaceValues.

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

Deprecated

Unsupported operation.

Guaranteed to throw an exception and leave the multimap unmodified.

Returns:ImmutableSet<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
@Deprecated
@Override
@DoNotCall:Always throws UnsupportedOperationException
Exceptions
UnsupportedOperationException:
always
toImmutableSetMultimapback to summary
public static <T extends @Nullable Object, K, V> Collector<T, ?, ImmutableSetMultimap<K, V>> toImmutableSetMultimap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)

Returns a Collector that accumulates elements into an ImmutableSetMultimap whose keys and values are the result of applying the provided mapping functions to the input elements.

For streams with defined encounter order (as defined in the Ordering section of the java.util.stream Javadoc), that order is preserved, but entries are grouped by key.

Example:

static final Multimap<Character, String> FIRST_LETTER_MULTIMAP =
    Stream.of("banana", "apple", "carrot", "asparagus", "cherry")
        .collect(toImmutableSetMultimap(str -> str.charAt(0), str -> str.substring(1)));

// is equivalent to

static final Multimap<Character, String> FIRST_LETTER_MULTIMAP =
    new ImmutableSetMultimap.Builder<Character, String>()
        .put('b', "anana")
        .putAll('a', "pple", "sparagus")
        .putAll('c', "arrot", "herry")
        .build();
Since
21.0
valueComparatorback to summary
pack-priv Comparator<? super V> valueComparator()
Annotations
@CheckForNull
valuesBuilderback to summary
private static <V> ImmutableSet.Builder<V> valuesBuilder(Comparator<? super V> valueComparator)
valueSetback to summary
private static <V> ImmutableSet<V> valueSet(Comparator<? super V> valueComparator, Collection<? extends V> values)
writeObjectback to summary
private void writeObject(ObjectOutputStream stream) throws IOException
Annotations
@GwtIncompatible
@J2ktIncompatible
Serial data
number of distinct keys, and then for each distinct key: the key, the number of values for that key, and the key's values
com.google.common.collect back to summary

public final Class ImmutableSetMultimap.Builder<K, V>

extends ImmutableMultimap.Builder<K, V>
Class Inheritance

A builder for creating immutable SetMultimap instances, especially public static final multimaps ("constant multimaps"). Example:
static final Multimap<String, Integer> STRING_TO_INTEGER_MULTIMAP =
    new ImmutableSetMultimap.Builder<String, Integer>()
        .put("one", 1)
        .putAll("several", 1, 2, 3)
        .putAll("many", 1, 2, 3, 4, 5)
        .build();

Builder instances can be reused; it is safe to call build multiple times to build multiple multimaps in series. Each multimap contains the key-value mappings in the previously created multimaps.

Since
2.0

Field Summary

Inherited from com.google.common.collect.ImmutableMultimap.Builder:
builderMapkeyComparatorvalueComparator

Constructor Summary

AccessConstructor and Description
public
Builder()

Creates a new builder.

Method Summary

Modifier and TypeMethod and Description
public ImmutableSetMultimap<K, V>
build()

Overrides com.google.common.collect.ImmutableMultimap.Builder.build.

Returns a newly-created immutable set multimap.
pack-priv ImmutableSetMultimap.Builder<K, V>
pack-priv Collection<V>
public ImmutableSetMultimap.Builder<K, V>
orderKeysBy(Comparator<? super K> keyComparator)

Overrides com.google.common.collect.ImmutableMultimap.Builder.orderKeysBy.

Specifies the ordering of the generated multimap's keys.
public ImmutableSetMultimap.Builder<K, V>
orderValuesBy(Comparator<? super V> valueComparator)

Overrides com.google.common.collect.ImmutableMultimap.Builder.orderValuesBy.

Specifies the ordering of the generated multimap's values for each key.
public ImmutableSetMultimap.Builder<K, V>
put(K key, V value)

Overrides com.google.common.collect.ImmutableMultimap.Builder.put.

Adds a key-value mapping to the built multimap if it is not already present.
public ImmutableSetMultimap.Builder<K, V>
put(Map.Entry<? extends K, ? extends V> entry)

Overrides com.google.common.collect.ImmutableMultimap.Builder.put.

Adds an entry to the built multimap if it is not already present.
public ImmutableSetMultimap.Builder<K, V>
putAll(Iterable<? extends Map.Entry<? extends K, ? extends V>> entries)

Overrides com.google.common.collect.ImmutableMultimap.Builder.putAll.

Adds entries to the built multimap.
public ImmutableSetMultimap.Builder<K, V>
putAll(K key, Iterable<? extends V> values)

Overrides com.google.common.collect.ImmutableMultimap.Builder.putAll.

Stores a collection of values with the same key in the built multimap.
public ImmutableSetMultimap.Builder<K, V>
putAll(K key, V... values)

Overrides com.google.common.collect.ImmutableMultimap.Builder.putAll.

Stores an array of values with the same key in the built multimap.
public ImmutableSetMultimap.Builder<K, V>
putAll(Multimap<? extends K, ? extends V> multimap)

Overrides com.google.common.collect.ImmutableMultimap.Builder.putAll.

Stores another multimap's entries in the built multimap.

Constructor Detail

Builderback to summary
public Builder()

Creates a new builder. The returned builder is equivalent to the builder generated by ImmutableSetMultimap#builder.

Method Detail

buildback to summary
public ImmutableSetMultimap<K, V> build()

Overrides com.google.common.collect.ImmutableMultimap.Builder.build.

Returns a newly-created immutable set multimap.

Annotations
@Override
combineback to summary
pack-priv ImmutableSetMultimap.Builder<K, V> combine(ImmutableMultimap.Builder<K, V> other)

Overrides com.google.common.collect.ImmutableMultimap.Builder.combine.

Annotations
@CanIgnoreReturnValue
@Override
newMutableValueCollectionback to summary
pack-priv Collection<V> newMutableValueCollection()

Overrides com.google.common.collect.ImmutableMultimap.Builder.newMutableValueCollection.

Annotations
@Override
orderKeysByback to summary
public ImmutableSetMultimap.Builder<K, V> orderKeysBy(Comparator<? super K> keyComparator)

Overrides com.google.common.collect.ImmutableMultimap.Builder.orderKeysBy.

Doc from com.google.common.collect.ImmutableMultimap.Builder.orderKeysBy.

Specifies the ordering of the generated multimap's keys.

Annotations
@CanIgnoreReturnValue
@Override
Since
8.0
orderValuesByback to summary
public ImmutableSetMultimap.Builder<K, V> orderValuesBy(Comparator<? super V> valueComparator)

Overrides com.google.common.collect.ImmutableMultimap.Builder.orderValuesBy.

Specifies the ordering of the generated multimap's values for each key.

If this method is called, the sets returned by the get() method of the generated multimap and its Multimap#asMap() view are ImmutableSortedSet instances. However, serialization does not preserve that property, though it does maintain the key and value ordering.

Annotations
@CanIgnoreReturnValue
@Override
Since
8.0
putback to summary
public ImmutableSetMultimap.Builder<K, V> put(K key, V value)

Overrides com.google.common.collect.ImmutableMultimap.Builder.put.

Adds a key-value mapping to the built multimap if it is not already present.

Annotations
@CanIgnoreReturnValue
@Override
putback to summary
public ImmutableSetMultimap.Builder<K, V> put(Map.Entry<? extends K, ? extends V> entry)

Overrides com.google.common.collect.ImmutableMultimap.Builder.put.

Adds an entry to the built multimap if it is not already present.

Annotations
@CanIgnoreReturnValue
@Override
Since
11.0
putAllback to summary
public ImmutableSetMultimap.Builder<K, V> putAll(Iterable<? extends Map.Entry<? extends K, ? extends V>> entries)

Overrides com.google.common.collect.ImmutableMultimap.Builder.putAll.

Doc from com.google.common.collect.ImmutableMultimap.Builder.putAll.

Adds entries to the built multimap.

Annotations
@CanIgnoreReturnValue
@Override
Since
19.0
putAllback to summary
public ImmutableSetMultimap.Builder<K, V> putAll(K key, Iterable<? extends V> values)

Overrides com.google.common.collect.ImmutableMultimap.Builder.putAll.

Doc from com.google.common.collect.ImmutableMultimap.Builder.putAll.

Stores a collection of values with the same key in the built multimap.

Annotations
@CanIgnoreReturnValue
@Override
putAllback to summary
public ImmutableSetMultimap.Builder<K, V> putAll(K key, V... values)

Overrides com.google.common.collect.ImmutableMultimap.Builder.putAll.

Doc from com.google.common.collect.ImmutableMultimap.Builder.putAll.

Stores an array of values with the same key in the built multimap.

Annotations
@CanIgnoreReturnValue
@Override
putAllback to summary
public ImmutableSetMultimap.Builder<K, V> putAll(Multimap<? extends K, ? extends V> multimap)

Overrides com.google.common.collect.ImmutableMultimap.Builder.putAll.

Doc from com.google.common.collect.ImmutableMultimap.Builder.putAll.

Stores another multimap's entries in the built multimap. The generated multimap's key and value orderings correspond to the iteration ordering of the multimap.asMap() view, with new keys and values following any existing keys and values.

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

private final Class ImmutableSetMultimap.EntrySet<K, V>

extends ImmutableSet<Map.Entry<K, V>>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final transient ImmutableSetMultimap<K, V>
Inherited from com.google.common.collect.ImmutableSet:
MAX_TABLE_SIZESPLITERATOR_CHARACTERISTICS

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(Object
element whose presence in this set is to be tested
object
)

Implements abstract com.google.common.collect.ImmutableCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Returns true if this set contains the specified element.
pack-priv boolean
isPartialView()

Implements abstract com.google.common.collect.ImmutableCollection.isPartialView.

Returns true if this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods.
public UnmodifiableIterator<Map.Entry<K, V>>
iterator()

Implements abstract com.google.common.collect.ImmutableSet.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).
Inherited from com.google.common.collect.ImmutableSet:
builderbuilderWithExpectedSizechooseTableSizecopyOfcopyOfcopyOfcopyOfequalshashCodeisHashCodeFastofofofofofofoftoImmutableSetwriteReplace

Field Detail

multimapback to summary
private final transient ImmutableSetMultimap<K, V> multimap
Annotations
@Weak

Constructor Detail

EntrySetback to summary
pack-priv EntrySet(ImmutableSetMultimap<K, V> multimap)

Method Detail

containsback to summary
public boolean contains(Object object)

Implements abstract com.google.common.collect.ImmutableCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Doc from java.util.Set.contains.

Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that Objects.equals(o, e).

Parameters
object:Object

element whose presence in this set is to be tested

Returns:boolean

true if this set contains the specified element

Annotations
@Override
isPartialViewback to summary
pack-priv boolean isPartialView()

Implements abstract com.google.common.collect.ImmutableCollection.isPartialView.

Doc from com.google.common.collect.ImmutableCollection.isPartialView.

Returns true if this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods. This is generally used to determine whether copyOf implementations should make an explicit copy to avoid memory leaks.

Annotations
@Override
iteratorback to summary
public UnmodifiableIterator<Map.Entry<K, V>> iterator()

Implements abstract com.google.common.collect.ImmutableSet.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.Set.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

Returns:UnmodifiableIterator<Map.Entry<K, V>>

an iterator over the elements in this set

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this set (its cardinality)

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

private final Class ImmutableSetMultimap.SetFieldSettersHolder

extends Object
Class Inheritance
  • java.lang.Object
  • com.google.common.collect.ImmutableSetMultimap.SetFieldSettersHolder
Annotations
@GwtIncompatible
@J2ktIncompatible

Field Summary

Modifier and TypeField and Description
pack-priv static final Serialization.FieldSetter<ImmutableSetMultimap<K, V>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_SET_FIELD_SETTERback to summary
pack-priv static final Serialization.FieldSetter<ImmutableSetMultimap<K, V>> EMPTY_SET_FIELD_SETTER

Constructor Detail

SetFieldSettersHolderback to summary
private SetFieldSettersHolder()