K - The key typeV - The value typepublic class SetMultimap<K,V>
extends java.lang.Object
Multimap whose collections of values are backed by a Set.| Modifier and Type | Field and Description |
|---|---|
protected java.util.function.Supplier<C> |
supplier |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all of the mappings.
|
boolean |
containsKey(java.lang.Object key) |
java.util.Set<java.util.Map.Entry<K,java.util.Collection<V>>> |
entrySet()
Map.Entry.getValue() always returns an unmodifiable collection. |
C |
get(K key)
This method never returns null.
|
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
static <K,V> SetMultimap<K,V> |
newConcurrentSetMultimap()
Creates a new instance backed by a
ConcurrentHashMap and synchronized HashSet. |
static <K,V> SetMultimap<K,V> |
newConcurrentSetMultimap(java.util.function.Supplier<java.util.Set<V>> valueSupplier)
Creates a new instance backed by a
ConcurrentHashMap and synchronized HashSet. |
static <K,V> SetMultimap<K,V> |
newSetMultimap()
Creates a new instance backed by a
HashMap and HashSet. |
static <K,V> SetMultimap<K,V> |
newSetMultimap(Multimap<K,V> multimap)
Creates a new instance backed by a
HashMap and HashSet. |
boolean |
put(K key,
V value) |
boolean |
putAll(K key,
java.util.Collection<? extends V> values) |
C |
replaceValues(K key,
java.lang.Iterable<? extends V> values)
Note that the original collection of values is completely replaced by a new collection which contains all elements from the given iterable.
|
int |
size()
Unlike Guava's
Multimap#size() this method returns the number of key-value mappings. |
java.lang.String |
toString() |
java.util.Set<V> |
uniqueValues() |
java.util.List<V> |
values()
The list may include the same value multiple times if it occurs in multiple mappings or if the collection of values for the mapping allows duplicate
elements.
|
public static <K,V> SetMultimap<K,V> newSetMultimap()
HashMap and HashSet.public static <K,V> SetMultimap<K,V> newSetMultimap(Multimap<K,V> multimap)
HashMap and HashSet. All key-value mappings are copied from the input multimap. If any
collection of values in the input multimap contains duplicate elements, these are removed in the constructed multimap.multimap - public static <K,V> SetMultimap<K,V> newConcurrentSetMultimap()
ConcurrentHashMap and synchronized HashSet.public static <K,V> SetMultimap<K,V> newConcurrentSetMultimap(java.util.function.Supplier<java.util.Set<V>> valueSupplier)
ConcurrentHashMap and synchronized HashSet.public int size()
MultimapMultimap#size() this method returns the number of key-value mappings.public boolean isEmpty()
public C replaceValues(K key, java.lang.Iterable<? extends V> values)
MultimapreplaceValues in interface Multimap<K,V>public boolean containsKey(java.lang.Object key)
containsKey in interface Multimap<K,V>true if the multimap contains a mapping for the given keypublic java.util.Set<K> keySet()
public java.util.List<V> values()
Multimappublic java.util.Set<V> uniqueValues()
uniqueValues in interface Multimap<K,V>public java.util.Set<java.util.Map.Entry<K,java.util.Collection<V>>> entrySet()
MultimapMap.Entry.getValue() always returns an unmodifiable collection. Map.Entry.setValue(Object) operation is not supported.public void clear()
Multimappublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2015. All Rights Reserved.