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.
| Modifier and Type | Class and Description |
|---|---|
| public static class | ImmutableSetMultimap.
A builder for creating immutable |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final transient ImmutableSet | emptySet
Returned by get() when a missing key is provided. |
| private transient ImmutableSet | |
| private transient ImmutableSetMultimap | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv | ImmutableSetMultimap(ImmutableMap<K, ImmutableSet<V>> map, int size, Comparator<? super V> valueComparator)
|
| Modifier and Type | Method and Description |
|---|---|
| public static <K, V> ImmutableSetMultimap. | |
| public static <K, V> ImmutableSetMultimap | copyOf(Multimap<? extends K, ? extends V> multimap)
Hides com. multimap.
|
| private static <K, V> ImmutableSetMultimap | |
| public static <K, V> ImmutableSetMultimap | |
| private static <V> ImmutableSet | |
| public ImmutableSet | entries()
Overrides com. Implements com. |
| public static <T extends @Nullable Object, K, V> Collector | flatteningToImmutableSetMultimap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends Stream<? extends V>> valuesFunction)
Returns a |
| pack-priv static <K, V> ImmutableSetMultimap | fromMapEntries(Collection<? extends Map.
Creates an ImmutableSetMultimap from an asMap.entrySet. |
| public ImmutableSet | get(K key)
Implements abstract com. Implements com. |
| public ImmutableSetMultimap | inverse()
Implements abstract com. |
| private ImmutableSetMultimap | |
| public static <K, V> ImmutableSetMultimap | |
| public static <K, V> ImmutableSetMultimap | of(K k1, V v1)
Returns an immutable multimap containing a single entry.
|
| public static <K, V> ImmutableSetMultimap | of(K k1, V v1, K k2, V v2)
Returns an immutable multimap containing the given entries, in order.
|
| public static <K, V> ImmutableSetMultimap | of(K k1, V v1, K k2, V v2, K k3, V v3)
Returns an immutable multimap containing the given entries, in order.
|
| public static <K, V> ImmutableSetMultimap | of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
Returns an immutable multimap containing the given entries, in order.
|
| public static <K, V> ImmutableSetMultimap | of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
Returns an immutable multimap containing the given entries, in order.
|
| private void | |
| public final ImmutableSet | removeAll(Object key)
Overrides com. Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the multimap unmodified.
|
| public final ImmutableSet | replaceValues(K key, Iterable<? extends V> values)
Overrides com. Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the multimap unmodified.
|
| public static <T extends @Nullable Object, K, V> Collector | toImmutableSetMultimap(Function<? super T, ? extends K> keyFunction, Function<? super T, ? extends V> valueFunction)
Returns a |
| pack-priv Comparator | |
| private static <V> ImmutableSet. | |
| private static <V> ImmutableSet | |
| private void |
| emptySet | back 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. | |
| entries | back to summary |
|---|---|
| private transient ImmutableSet<Map. Hides com. | |
| inverse | back to summary |
|---|---|
| private transient ImmutableSetMultimap<V, K> inverse
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides com. | |
| ImmutableSetMultimap | back to summary |
|---|---|
| pack-priv ImmutableSetMultimap(ImmutableMap<K, ImmutableSet<V>> map, int size, Comparator<? super V> valueComparator) | |
| builder | back to summary |
|---|---|
| public static <K, V> ImmutableSetMultimap. Hides com. Returns a new | |
| copyOf | back to summary |
|---|---|
| public static <K, V> ImmutableSetMultimap Hides com. Returns an immutable set multimap containing the same mappings as 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.
| |
| copyOf | back to summary |
|---|---|
| private static <K, V> ImmutableSetMultimap | |
| copyOf | back to summary |
|---|---|
| public static <K, V> ImmutableSetMultimap Hides com. 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.
| |
| emptySet | back to summary |
|---|---|
| private static <V> ImmutableSet | |
| entries | back to summary |
|---|---|
| public ImmutableSet Overrides com. Implements com. 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.
| |
| flatteningToImmutableSetMultimap | back to summary |
|---|---|
| public static <T extends @Nullable Object, K, V> Collector Returns a Example:
| |
| fromMapEntries | back to summary |
|---|---|
| pack-priv static <K, V> ImmutableSetMultimap Creates an ImmutableSetMultimap from an asMap.entrySet. | |
| get | back to summary |
|---|---|
| public ImmutableSet Implements abstract com. Implements com. 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.
| |
| inverse | back to summary |
|---|---|
| public ImmutableSetMultimap Implements abstract com. Doc from com. 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
| |
| invert | back to summary |
|---|---|
| private ImmutableSetMultimap | |
| of | back to summary |
|---|---|
| public static <K, V> ImmutableSetMultimap Hides com. Returns the empty multimap. Performance note: the instance returned is a singleton.
| |
| of | back to summary |
|---|---|
| public static <K, V> ImmutableSetMultimap Hides com. Returns an immutable multimap containing a single entry. | |
| of | back to summary |
|---|---|
| public static <K, V> ImmutableSetMultimap Hides com. Returns an immutable multimap containing the given entries, in order. Repeated occurrences of
an entry (according to | |
| of | back to summary |
|---|---|
| public static <K, V> ImmutableSetMultimap Hides com. Returns an immutable multimap containing the given entries, in order. Repeated occurrences of
an entry (according to | |
| of | back to summary |
|---|---|
| public static <K, V> ImmutableSetMultimap Hides com. Returns an immutable multimap containing the given entries, in order. Repeated occurrences of
an entry (according to | |
| of | back to summary |
|---|---|
| public static <K, V> ImmutableSetMultimap Hides com. Returns an immutable multimap containing the given entries, in order. Repeated occurrences of
an entry (according to | |
| readObject | back to summary |
|---|---|
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
| |
| removeAll | back to summary |
|---|---|
| public final ImmutableSet Overrides com. Implements com. Deprecated Unsupported operation. Guaranteed to throw an exception and leave the multimap unmodified.
| |
| replaceValues | back to summary |
|---|---|
| public final ImmutableSet Overrides com. Implements com. Deprecated Unsupported operation. Guaranteed to throw an exception and leave the multimap unmodified.
| |
| toImmutableSetMultimap | back to summary |
|---|---|
| public static <T extends @Nullable Object, K, V> Collector Returns a For streams with defined encounter order (as defined in the Ordering section of the Example:
| |
| valueComparator | back to summary |
|---|---|
pack-priv Comparator
| |
| valuesBuilder | back to summary |
|---|---|
| private static <V> ImmutableSet. | |
| valueSet | back to summary |
|---|---|
| private static <V> ImmutableSet | |
| writeObject | back to summary |
|---|---|
private void writeObject(ObjectOutputStream stream) throws IOException
| |
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.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ImmutableSetMultimap | build()
Overrides com. |
| pack-priv ImmutableSetMultimap. | combine(ImmutableMultimap.
Overrides com. |
| pack-priv Collection | |
| public ImmutableSetMultimap. | orderKeysBy(Comparator<? super K> keyComparator)
Overrides com. |
| public ImmutableSetMultimap. | orderValuesBy(Comparator<? super V> valueComparator)
Overrides com. |
| public ImmutableSetMultimap. | put(K key, V value)
Overrides com. |
| public ImmutableSetMultimap. | put(Map.
Overrides com. |
| public ImmutableSetMultimap. | putAll(Iterable<? extends Map.
Overrides com. |
| public ImmutableSetMultimap. | putAll(K key, Iterable<? extends V> values)
Overrides com. |
| public ImmutableSetMultimap. | putAll(K key, V... values)
Overrides com. |
| public ImmutableSetMultimap. | putAll(Multimap<? extends K, ? extends V> multimap)
Overrides com. |
| Builder | back to summary |
|---|---|
| public Builder() Creates a new builder. The returned builder is equivalent to the builder generated by | |
| build | back to summary |
|---|---|
| public ImmutableSetMultimap Overrides com. Returns a newly-created immutable set multimap.
| |
| combine | back to summary |
|---|---|
| pack-priv ImmutableSetMultimap. Overrides com.
| |
| newMutableValueCollection | back to summary |
|---|---|
| pack-priv Collection Overrides com.
| |
| orderKeysBy | back to summary |
|---|---|
| public ImmutableSetMultimap. Overrides com. Doc from com. Specifies the ordering of the generated multimap's keys.
| |
| orderValuesBy | back to summary |
|---|---|
| public ImmutableSetMultimap. Overrides com. Specifies the ordering of the generated multimap's values for each key. If this method is called, the sets returned by the
| |
| put | back to summary |
|---|---|
| public ImmutableSetMultimap. Overrides com. Adds a key-value mapping to the built multimap if it is not already present.
| |
| put | back to summary |
|---|---|
| public ImmutableSetMultimap. Overrides com. Adds an entry to the built multimap if it is not already present.
| |
| putAll | back to summary |
|---|---|
| public ImmutableSetMultimap. Overrides com. Doc from com. Adds entries to the built multimap.
| |
| putAll | back to summary |
|---|---|
| public ImmutableSetMultimap. Overrides com. Doc from com. Stores a collection of values with the same key in the built multimap.
| |
| putAll | back to summary |
|---|---|
| public ImmutableSetMultimap. Overrides com. Doc from com. Stores an array of values with the same key in the built multimap.
| |
| putAll | back to summary |
|---|---|
| public ImmutableSetMultimap. Overrides com. Doc from com. Stores another multimap's entries in the built multimap. The generated multimap's key and
value orderings correspond to the iteration ordering of the
| |
| Modifier and Type | Field and Description |
|---|---|
| private final transient ImmutableSetMultimap |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | contains(Object
element whose presence in this set is to be tested object)Implements abstract com. Implements java. true if this set contains the specified element.
|
| pack-priv boolean | isPartialView()
Implements abstract com. true if this immutable collection's implementation contains references to
user-created objects that aren't accessible via this collection's methods.
|
| public UnmodifiableIterator | iterator()
Implements abstract com. Implements java. |
| public int | size()
Implements abstract java. Implements java. |
| pack-priv Object |
| multimap | back to summary |
|---|---|
| private final transient ImmutableSetMultimap<K, V> multimap
| |
| EntrySet | back to summary |
|---|---|
| pack-priv EntrySet(ImmutableSetMultimap<K, V> multimap) | |
| contains | back to summary |
|---|---|
| public boolean contains(Object object) Implements abstract com. Implements java. Doc from java. Returns | |
| isPartialView | back to summary |
|---|---|
| pack-priv boolean isPartialView() Implements abstract com. Doc from com. Returns
| |
| iterator | back to summary |
|---|---|
| public UnmodifiableIterator Implements abstract com. Implements java. Doc from java. 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).
| |
| size | back to summary |
|---|---|
| public int size() Implements abstract java. Implements java. Doc from java. Returns the number of elements in this set (its cardinality). If this
set contains more than
| |
| writeReplace | back to summary |
|---|---|
| pack-priv Object writeReplace() Overrides com.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final Serialization. |
| Access | Constructor and Description |
|---|---|
| private |
| EMPTY_SET_FIELD_SETTER | back to summary |
|---|---|
| pack-priv static final Serialization. | |
| SetFieldSettersHolder | back to summary |
|---|---|
| private SetFieldSettersHolder() | |