Multimap whose contents will never change, with many other important properties
detailed at ImmutableCollection.Warning
avoid direct usage of ImmutableMultimap as a type (as with
Multimap itself). Prefer subtypes such as ImmutableSetMultimap or ImmutableListMultimap, which have well-defined equals semantics, thus avoiding a common
source of bugs and confusion.
Note
every ImmutableMultimap offers an inverse view, so there is no
need for a distinct ImmutableBiMultimap type.
Key-grouped iteration. All view collections follow the same iteration order. In all
current implementations, the iteration order always keeps multiple entries with the same key
together. Any creation method that would customarily respect insertion order (such as copyOf(Multimap)) instead preserves key-grouped order by inserting entries for an existing key
immediately after the last entry having that key.
See the Guava User Guide article on immutable collections.
| Modifier and Type | Class and Description |
|---|---|
| public static class | ImmutableMultimap.
A builder for creating immutable multimap instances, especially |
| private static class | |
| pack-priv static class | |
| pack-priv class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final transient ImmutableMap | |
| private static final long | |
| pack-priv final transient int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ImmutableMap | asMap()
Overrides com. Implements com. |
| public static <K, V> ImmutableMultimap. | |
| public final void | clear()
Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the multimap unmodified.
|
| public boolean | containsKey(Object key)
Implements com. true if this multimap contains at least one key-value pair with the key key.
|
| public boolean | containsValue(Object value)
Overrides com. Implements com. true if this multimap contains at least one key-value pair with the value
value.
|
| public static <K, V> ImmutableMultimap | |
| public static <K, V> ImmutableMultimap | |
| pack-priv Map | |
| pack-priv ImmutableCollection | |
| pack-priv ImmutableMultiset | |
| pack-priv Set | |
| pack-priv ImmutableCollection | |
| public ImmutableCollection | entries()
Overrides com. Implements com. |
| pack-priv UnmodifiableIterator | |
| pack-priv Spliterator | |
| public void | forEach(BiConsumer<? super K, ? super V> action)
Overrides default com. |
| public abstract ImmutableCollection | get(K key)
Redeclares com. |
| public abstract ImmutableMultimap | |
| pack-priv boolean | isPartialView()
Returns |
| public ImmutableMultiset | keys()
Overrides com. Implements com. keySet.
|
| public ImmutableSet | keySet()
Overrides com. Implements com. |
| public static <K, V> ImmutableMultimap | |
| public static <K, V> ImmutableMultimap | |
| public static <K, V> ImmutableMultimap | |
| public static <K, V> ImmutableMultimap | of(K k1, V v1, K k2, V v2, K k3, V v3)
Returns an immutable multimap containing the given entries, in the "key-grouped" insertion order described in the class documentation. |
| public static <K, V> ImmutableMultimap | 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 the "key-grouped" insertion order described in the class documentation. |
| public static <K, V> ImmutableMultimap | 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 the "key-grouped" insertion order described in the class documentation. |
| public final boolean | put(K key, V value)
Overrides com. Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the multimap unmodified.
|
| public final boolean | putAll(K key, Iterable<? extends V> values)
Overrides com. Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the multimap unmodified.
|
| public final boolean | putAll(Multimap<? extends K, ? extends V> multimap)
Overrides com. Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the multimap unmodified.
|
| public final boolean | remove(Object key, Object value)
Overrides com. Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the multimap unmodified.
|
| public ImmutableCollection | removeAll(Object key)
Implements com.
Deprecated
Unsupported operation.
Guaranteed to throw an exception and leave the multimap unmodified.
|
| public ImmutableCollection | 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 int | size()
Implements com. |
| pack-priv UnmodifiableIterator | |
| public ImmutableCollection | values()
Overrides com. Implements com. |