Class LongLongHppcOpenHashMap

java.lang.Object
com.almworks.integers.AbstractWritableLongLongMap
com.almworks.integers.wrappers.LongLongHppcOpenHashMap
All Implemented Interfaces:
com.almworks.integers.LongLongIterable, com.almworks.integers.LongLongMap, com.almworks.integers.WritableLongLongMap, Iterable<com.almworks.integers.LongLongIterator>

public class LongLongHppcOpenHashMap extends com.almworks.integers.AbstractWritableLongLongMap
  • Field Summary

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

    Fields inherited from class com.almworks.integers.AbstractWritableLongLongMap

    myModCount

    Fields inherited from interface com.almworks.integers.LongLongMap

    DEFAULT_VALUE, EMPTY
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    long
    addTo(long key, long additionValue)
     
    void
     
    boolean
    containsKey(long 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(long[] keys, long[] values)
     
    createFrom(com.almworks.integers.LongIterable keys, com.almworks.integers.LongIterable values)
     
    long
    get(long key)
     
    @NotNull com.almworks.integers.LongLongIterator
     
    com.almworks.integers.LongIterator
     
    long
    Returns the last value saved in a call to containsKey(long).
    long
    lset(long value)
    Sets the value corresponding to the key saved in the last call to containsKey(long), if and only if the key exists in the map already.
    int
     
    protected long
    putImpl(long key, long value)
     
    long
    putOrAdd(long key, long putValue, long additionValue)
    Trove-inspired API method.
    boolean
    remove(long key, long value)
     
    protected long
    removeImpl(long key)
     
    int
     
    com.almworks.integers.LongIterator
     

    Methods inherited from class com.almworks.integers.AbstractWritableLongLongMap

    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.LongLongOpenHashMap myMap
  • Constructor Details

    • LongLongHppcOpenHashMap

      public LongLongHppcOpenHashMap()
    • LongLongHppcOpenHashMap

      public LongLongHppcOpenHashMap(int initialCapacity)
    • LongLongHppcOpenHashMap

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

    • createFrom

      public static LongLongHppcOpenHashMap createFrom(com.almworks.integers.LongIterable keys, com.almworks.integers.LongIterable values)
    • createFrom

      public static LongLongHppcOpenHashMap createFrom(long[] keys, long[] values)
    • createForAdd

      public static LongLongHppcOpenHashMap 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 LongLongHppcOpenHashMap createForAdd(int count)
      Creates new hashmap with default load factor
      See Also:
    • containsKey

      public boolean containsKey(long key)
    • size

      public int size()
    • iterator

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

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

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

      public long get(long key)
    • clear

      public void clear()
    • putImpl

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

      public long putOrAdd(long key, long putValue, long additionValue)
      Trove-inspired API method. An equivalent of the following code:
        if (containsKey(key))
        {
            long v = (long) (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 long addTo(long key, long additionValue)
    • lget

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

      public long lset(long value)
      Sets the value corresponding to the key saved in the last call to containsKey(long), 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(long) if it returned true.
      See Also:
    • removeImpl

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

      public boolean remove(long key, long value)
      Specified by:
      remove in interface com.almworks.integers.WritableLongLongMap
      Overrides:
      remove in class com.almworks.integers.AbstractWritableLongLongMap