Package akka.util
Class Index<K,V>
- java.lang.Object
-
- akka.util.Index<K,V>
-
- Direct Known Subclasses:
ConcurrentMultiMap
public class Index<K,V> extends java.lang.Object
An implementation of a ConcurrentMultiMap Adds/remove is serialized over the specified key Reads are fully concurrent <-- el-cheapo
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Removes all keys and all valuesscala.Option<V>
findValue(K key, scala.Function1<V,java.lang.Object> f)
void
foreach(scala.Function2<K,V,scala.runtime.BoxedUnit> fun)
Applies the supplied function to all keys and their valuesboolean
isEmpty()
scala.collection.Iterable<K>
keys()
Returns the key set.int
mapSize()
boolean
put(K key, V value)
Associates the value of type V with the key of type Kscala.Option<scala.collection.Iterable<V>>
remove(K key)
Disassociates all the values for the specified keyboolean
remove(K key, V value)
Disassociates the value of type V from the key of type Kvoid
removeValue(V value)
Removes the specified value from all keysjava.util.Comparator<V>
valueComparator()
scala.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.
-
-
-
Method Detail
-
clear
public void clear()
Removes all keys and all values
-
findValue
public scala.Option<V> findValue(K key, scala.Function1<V,java.lang.Object> f)
- 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
public void foreach(scala.Function2<K,V,scala.runtime.BoxedUnit> fun)
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
public scala.collection.Iterable<K> keys()
Returns the key set.
-
mapSize
public int mapSize()
-
put
public boolean put(K key, V value)
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
public boolean remove(K key, V value)
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
public scala.Option<scala.collection.Iterable<V>> remove(K key)
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
public void removeValue(V value)
Removes the specified value from all keys
-
valueComparator
public java.util.Comparator<V> valueComparator()
-
valueIterator
public scala.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 exist
-
values
public scala.collection.immutable.Set<V> values()
Returns the union of all value sets.
-
-