Class IntIntHppcOpenHashMap

java.lang.Object
com.almworks.integers.AbstractWritableIntIntMap
com.almworks.integers.wrappers.IntIntHppcOpenHashMap
All Implemented Interfaces:
com.almworks.integers.IntIntIterable, com.almworks.integers.IntIntMap, com.almworks.integers.WritableIntIntMap, Iterable<com.almworks.integers.IntIntIterator>

public class IntIntHppcOpenHashMap extends com.almworks.integers.AbstractWritableIntIntMap
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final com.carrotsearch.hppc.IntIntOpenHashMap
     

    Fields inherited from class com.almworks.integers.AbstractWritableIntIntMap

    myModCount

    Fields inherited from interface com.almworks.integers.IntIntMap

    DEFAULT_VALUE, EMPTY
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    IntIntHppcOpenHashMap(int initialCapacity)
     
    IntIntHppcOpenHashMap(int initialCapacity, float loadFactor)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    addTo(int key, int additionValue)
     
    void
     
    boolean
    containsKey(int key)
     
    createForAdd(int count)
    Creates new hashmap with default load factor
    createForAdd(int count, float loadFactor)
    Creates new hashmap with the specified load factor that is garanteed to not invoke resize after adding count elements
    createFrom(int[] keys, int[] values)
     
    createFrom(com.almworks.integers.IntIterable keys, com.almworks.integers.IntIterable values)
     
    int
    get(int key)
     
    @NotNull com.almworks.integers.IntIntIterator
     
    com.almworks.integers.IntIterator
     
    int
    Returns the last value saved in a call to containsKey(int).
    int
    lset(int value)
    Sets the value corresponding to the key saved in the last call to containsKey(int), if and only if the key exists in the map already.
    int
     
    protected int
    putImpl(int key, int value)
     
    int
    putOrAdd(int key, int putValue, int additionValue)
    Trove-inspired API method.
    boolean
    remove(int key, int value)
     
    protected int
    removeImpl(int key)
     
    int
     
    com.almworks.integers.IntIterator
     

    Methods inherited from class com.almworks.integers.AbstractWritableIntIntMap

    add, containsAnyKeys, containsKeys, equals, hashCode, isEmpty, keySet, modified, put, putAll, putAll, putAll, putAllKeys, putIfAbsent, remove, removeAll, removeAll, toString, toString, toTableString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

    • myMap

      protected final com.carrotsearch.hppc.IntIntOpenHashMap myMap
  • Constructor Details

    • IntIntHppcOpenHashMap

      public IntIntHppcOpenHashMap()
    • IntIntHppcOpenHashMap

      public IntIntHppcOpenHashMap(int initialCapacity)
    • IntIntHppcOpenHashMap

      public IntIntHppcOpenHashMap(int initialCapacity, float loadFactor)
  • Method Details

    • createFrom

      public static IntIntHppcOpenHashMap createFrom(com.almworks.integers.IntIterable keys, com.almworks.integers.IntIterable values)
    • createFrom

      public static IntIntHppcOpenHashMap createFrom(int[] keys, int[] values)
    • createForAdd

      public static IntIntHppcOpenHashMap createForAdd(int count, float loadFactor)
      Creates new hashmap with the specified load factor that is garanteed to not invoke resize after adding count elements
      Returns:
      new hashmap with the specified capacity dependent on count and loadFactor
    • createForAdd

      public static IntIntHppcOpenHashMap createForAdd(int count)
      Creates new hashmap with default load factor
      See Also:
    • containsKey

      public boolean containsKey(int key)
    • size

      public int size()
    • iterator

      @NotNull public @NotNull com.almworks.integers.IntIntIterator iterator()
    • keysIterator

      public com.almworks.integers.IntIterator keysIterator()
    • valuesIterator

      public com.almworks.integers.IntIterator valuesIterator()
    • get

      public int get(int key)
    • clear

      public void clear()
    • putImpl

      protected int putImpl(int key, int value)
      Specified by:
      putImpl in class com.almworks.integers.AbstractWritableIntIntMap
    • putOrAdd

      public int putOrAdd(int key, int putValue, int additionValue)
      Trove-inspired API method. An equivalent of the following code:
        if (containsKey(key))
        {
            int v = (int) (lget() + additionValue);
            lset(v);
            return v;
        }
        else
        {
           put(key, putValue);
           return putValue;
        }
       
      Parameters:
      key - The key of the value to adjust.
      putValue - The value to put if key does not exist.
      additionValue - The value to add to the existing value if key exists.
      Returns:
      Returns the current value associated with key (after changes).
    • addTo

      public int addTo(int key, int additionValue)
    • lget

      public int lget()
      Returns the last value saved in a call to containsKey(int).
      See Also:
    • lset

      public int lset(int value)
      Sets the value corresponding to the key saved in the last call to containsKey(int), if and only if the key exists in the map already.
      Returns:
      Returns the previous value stored under the given key.
      See Also:
    • lslot

      public int lslot()
      Returns:
      Returns the slot of the last key looked up in a call to containsKey(int) if it returned true.
      See Also:
    • removeImpl

      protected int removeImpl(int key)
      Specified by:
      removeImpl in class com.almworks.integers.AbstractWritableIntIntMap
    • remove

      public boolean remove(int key, int value)
      Specified by:
      remove in interface com.almworks.integers.WritableIntIntMap
      Overrides:
      remove in class com.almworks.integers.AbstractWritableIntIntMap