Package org.apache.pekko.util
Class Index<K,V>
java.lang.Object
org.apache.pekko.util.Index<K,V>
- Direct Known Subclasses:
ConcurrentMultiMap
An implementation of a ConcurrentMultiMap
Adds/remove is serialized over the specified key
Reads are fully concurrent <-- el-cheapo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all keys and all valuesscala.Option<V>voidApplies the supplied function to all keys and their valuesbooleanisEmpty()scala.collection.Iterable<K>keys()Returns the key set.intmapSize()booleanAssociates the value of type V with the key of type Kscala.Option<scala.collection.Iterable<V>>Disassociates all the values for the specified keybooleanDisassociates the value of type V from the key of type KvoidremoveValue(V value) Removes the specified value from all keysscala.collection.Iterator<V>valueIterator(K key) Returns an Iterator of V containing the values for the supplied key, or an empty iterator if the key doesn't existscala.collection.immutable.Set<V>values()Returns the union of all value sets.
-
Constructor Details
-
Index
-
Index
-
-
Method Details
-
clear
public void clear()Removes all keys and all values -
findValue
- Returns:
- Some(value) for the first matching value where the supplied function returns true for the given key, if no matches it returns None
-
foreach
Applies the supplied function to all keys and their values -
isEmpty
public boolean isEmpty()- Returns:
- true if the underlying containers is empty, may report false negatives when the last remove is underway
-
keys
Returns the key set. -
mapSize
public int mapSize() -
put
Associates the value of type V with the key of type K- Returns:
- true if the value didn't exist for the key previously, and false otherwise
-
remove
Disassociates the value of type V from the key of type K- Returns:
- true if the value was disassociated from the key and false if it wasn't previously associated with the key
-
remove
Disassociates all the values for the specified key- Returns:
- None if the key wasn't associated at all, or Some(scala.Iterable[V]) if it was associated
-
removeValue
Removes the specified value from all keys -
valueComparator
-
valueIterator
Returns an Iterator of V containing the values for the supplied key, or an empty iterator if the key doesn't exist -
values
Returns the union of all value sets.
-