K
- Key typeV
- Value type@InterfaceAudience.Private @InterfaceStability.Evolving public class ConcurrentIndex<K,V> extends Object
Multiset
, with the following exceptions:
Modifier and Type | Class and Description |
---|---|
private static class |
ConcurrentIndex.DefaultValueSetFactory<V>
Default factory class for the sets associated with given keys.
|
Modifier and Type | Field and Description |
---|---|
private ConcurrentMap<K,Set<V>> |
container
Container for the sets, indexed by key
|
private com.google.common.base.Supplier<Set<V>> |
valueSetFactory
A factory that constructs new instances of the sets if no set is
associated with a given key.
|
Constructor and Description |
---|
ConcurrentIndex(Comparator<V> valueComparator)
Creates an instance using the DefaultValueSetFactory for sets,
which in turn creates instances of
ConcurrentSkipListSet |
ConcurrentIndex(com.google.common.base.Supplier<Set<V>> valueSetFactory)
Creates an instance with a specified factory object for sets to be
associated with a given key.
|
Modifier and Type | Method and Description |
---|---|
void |
put(K key,
V value)
Associate a new unique value with a specified key.
|
boolean |
remove(K key,
V value)
Removes the association between a specified key and value.
|
Set<V> |
values(K key)
Get all values associated with a specified key or null if no values are
associated.
|
private final ConcurrentMap<K,Set<V>> container
public ConcurrentIndex(com.google.common.base.Supplier<Set<V>> valueSetFactory)
valueSetFactory
- The factory instancepublic ConcurrentIndex(Comparator<V> valueComparator)
ConcurrentSkipListSet
valueComparator
- A Comparator
for value typespublic void put(K key, V value)
key
- The keyvalue
- An additional unique value we want to associate with a keypublic Set<V> values(K key)
ConcurrentModificationException
may be thrown.key
- The keyCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.