Package akka.util

Class ImmutableIntMap


  • public final class ImmutableIntMap
    extends java.lang.Object
    INTERNAL API Specialized Map for primitive Int keys and values to avoid allocations (boxing). Keys and values are encoded consecutively in a single Int array and does copy-on-write with no structural sharing, it's intended for rather small maps (<1000 elements).
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(int key)
      Worst case O(log n), allocation free.
      static ImmutableIntMap empty()  
      boolean equals​(java.lang.Object obj)  
      int get​(int key)
      Worst case O(log n), allocation free.
      int hashCode()  
      scala.collection.Iterator<java.lang.Object> keysIterator()
      All keys
      ImmutableIntMap remove​(int key)
      Worst case O(n), creates new ImmutableIntMap without the given key.
      int size()  
      java.lang.String toString()  
      ImmutableIntMap updated​(int key, int value)
      Worst case O(n), creates new ImmutableIntMap with the given key with the given value.
      ImmutableIntMap updateIfAbsent​(int key, scala.Function0<java.lang.Object> value)
      Worst case O(n), creates new ImmutableIntMap with the given key and value if that key is not yet present in the map.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • size

        public final int size()
      • get

        public final int get​(int key)
        Worst case O(log n), allocation free. Will return Int.MinValue if not found, so beware of storing Int.MinValues
        Parameters:
        key - (undocumented)
        Returns:
        (undocumented)
      • contains

        public final boolean contains​(int key)
        Worst case O(log n), allocation free.
        Parameters:
        key - (undocumented)
        Returns:
        (undocumented)
      • updateIfAbsent

        public final ImmutableIntMap updateIfAbsent​(int key,
                                                    scala.Function0<java.lang.Object> value)
        Worst case O(n), creates new ImmutableIntMap with the given key and value if that key is not yet present in the map.
        Parameters:
        key - (undocumented)
        value - (undocumented)
        Returns:
        (undocumented)
      • updated

        public final ImmutableIntMap updated​(int key,
                                             int value)
        Worst case O(n), creates new ImmutableIntMap with the given key with the given value.
        Parameters:
        key - (undocumented)
        value - (undocumented)
        Returns:
        (undocumented)
      • remove

        public final ImmutableIntMap remove​(int key)
        Worst case O(n), creates new ImmutableIntMap without the given key.
        Parameters:
        key - (undocumented)
        Returns:
        (undocumented)
      • keysIterator

        public final scala.collection.Iterator<java.lang.Object> keysIterator()
        All keys
        Returns:
        (undocumented)
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object