Package akka.util

Class Index<K,​V>

  • Direct Known Subclasses:
    ConcurrentMultiMap

    public class Index<K,​V>
    extends java.lang.Object
    Associates the value of type V with the key of type K
    • Constructor Summary

      Constructors 
      Constructor Description
      Index​(int mapSize, java.util.Comparator<V> valueComparator)  
      Index​(int mapSize, scala.Function2<V,​V,​java.lang.Object> cmp)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Removes all keys and all values
      scala.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 values
      boolean 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 K
      scala.Option<scala.collection.Iterable<V>> remove​(K key)
      Disassociates all the values for the specified key
      boolean remove​(K key, V value)
      Disassociates the value of type V from the key of type K
      void removeValue​(V value)
      Removes the specified value from all keys
      java.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 exist
      scala.collection.immutable.Set<V> values()
      Returns the union of all value sets.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Index

        public Index​(int mapSize,
                     java.util.Comparator<V> valueComparator)
      • Index

        public Index​(int mapSize,
                     scala.Function2<V,​V,​java.lang.Object> cmp)
    • 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)
        Parameters:
        key - (undocumented)
        f - (undocumented)
        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
        Parameters:
        fun - (undocumented)
      • 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.
        Returns:
        (undocumented)
      • mapSize

        public int mapSize()
      • put

        public boolean put​(K key,
                           V value)
        Associates the value of type V with the key of type K
        Parameters:
        key - (undocumented)
        value - (undocumented)
        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
        Parameters:
        key - (undocumented)
        value - (undocumented)
        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
        Parameters:
        key - (undocumented)
        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
        Parameters:
        value - (undocumented)
      • 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
        Parameters:
        key - (undocumented)
        Returns:
        (undocumented)
      • values

        public scala.collection.immutable.Set<V> values()
        Returns the union of all value sets.
        Returns:
        (undocumented)