Multimap that cannot hold duplicate key-value pairs. Adding a key-value pair that's
already in the multimap has no effect. See the Multimap documentation for information
common to all multimaps.
The get, removeAll, and replaceValues methods each return a Set of values, while entries returns a Set of map entries. Though the method
signature doesn't say so explicitly, the map returned by asMap has Set values.
If the values corresponding to a single key should be ordered according to a java. (or the natural order), see the SortedSetMultimap subinterface.
Since the value collections are sets, the behavior of a SetMultimap is not specified
if key or value objects already present in the multimap change in a manner that affects
equals comparisons. Use caution if mutable objects are used as keys or values in a SetMultimap.
Warning
Do not modify either a key or a value of a SetMultimap in a way
that affects its Object#equals behavior. Undefined behavior and bugs will result.
See the Guava User Guide article on Multimap.
| Modifier and Type | Method and Description |
|---|---|
| public Map | asMap()
Redeclares com. Map from each distinct key to the nonempty
collection of that key's associated values.
|
| public Set | entries()
Redeclares com. Entry
instances.
|
| public boolean | equals(Object obj)
Redeclares com. |
| public Set | get(K key)
Redeclares com. key in this multimap, if any.
|
| public Set | removeAll(Object key)
Redeclares com. key.
|
| public Set | replaceValues(K key, Iterable<? extends V> values)
Redeclares com. |
| asMap | back to summary |
|---|---|
| public Map Redeclares com. Doc from com. Returns a view of this multimap as a Changes to the returned map or the collections that serve as its values will update the
underlying multimap, and vice versa. The map does not support Note The returned map's values are guaranteed to be of type
| |
| entries | back to summary |
|---|---|
| public Set Redeclares com. Doc from com. Returns a view collection of all key-value pairs contained in this multimap, as Changes to the returned collection or the entries it contains will update the underlying multimap, and vice versa. However, adding to the returned collection is not possible. Because a
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Redeclares com. Compares the specified object to this multimap for equality. Two An empty
| |
| get | back to summary |
|---|---|
| public Set Redeclares com. Doc from com. Returns a view collection of the values associated with Changes to the returned collection will update the underlying multimap, and vice versa. Because a
| |
| removeAll | back to summary |
|---|---|
| public Set Redeclares com. Doc from com. Removes all values associated with the key Once this method returns, Because a
| |
| replaceValues | back to summary |
|---|---|
| public Set Redeclares com. Doc from com. Stores a collection of values with the same key, replacing any existing values for that key. If Because a Any duplicates in
| |