Package com.almworks.integers.wrappers
Class LongIntHppcOpenHashMap
java.lang.Object
com.almworks.integers.AbstractWritableLongIntMap
com.almworks.integers.wrappers.LongIntHppcOpenHashMap
- All Implemented Interfaces:
com.almworks.integers.LongIntIterable,com.almworks.integers.LongIntMap,com.almworks.integers.WritableLongIntMap,Iterable<com.almworks.integers.LongIntIterator>
public class LongIntHppcOpenHashMap
extends com.almworks.integers.AbstractWritableLongIntMap
-
Field Summary
FieldsFields inherited from class com.almworks.integers.AbstractWritableLongIntMap
myModCountFields inherited from interface com.almworks.integers.LongIntMap
DEFAULT_VALUE, EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionLongIntHppcOpenHashMap(int initialCapacity) LongIntHppcOpenHashMap(int initialCapacity, float loadFactor) -
Method Summary
Modifier and TypeMethodDescriptionintaddTo(long key, int additionValue) voidclear()booleancontainsKey(long key) static LongIntHppcOpenHashMapcreateForAdd(int count) Creates new hashmap with default load factorstatic LongIntHppcOpenHashMapcreateForAdd(int count, float loadFactor) Creates new hashmap with the specified load factor that is garanteed to not invokeresizeafter addingcountelementsstatic LongIntHppcOpenHashMapcreateFrom(long[] keys, int[] values) static LongIntHppcOpenHashMapcreateFrom(com.almworks.integers.LongIterable keys, com.almworks.integers.IntIterable values) intget(long key) @NotNull com.almworks.integers.LongIntIteratoriterator()com.almworks.integers.LongIteratorintlget()Returns the last value saved in a call tocontainsKey(long).intlset(int value) Sets the value corresponding to the key saved in the last call tocontainsKey(long), if and only if the key exists in the map already.intlslot()protected intputImpl(long key, int value) intputOrAdd(long key, int putValue, int additionValue) Trove-inspired API method.booleanremove(long key, int value) protected intremoveImpl(long key) intsize()com.almworks.integers.IntIteratorMethods inherited from class com.almworks.integers.AbstractWritableLongIntMap
add, containsAnyKeys, containsKeys, equals, hashCode, isEmpty, keySet, modified, put, putAll, putAll, putAll, putAllKeys, putIfAbsent, remove, removeAll, removeAll, toString, toString, toTableStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
myMap
protected final com.carrotsearch.hppc.LongIntOpenHashMap myMap
-
-
Constructor Details
-
LongIntHppcOpenHashMap
public LongIntHppcOpenHashMap() -
LongIntHppcOpenHashMap
public LongIntHppcOpenHashMap(int initialCapacity) -
LongIntHppcOpenHashMap
public LongIntHppcOpenHashMap(int initialCapacity, float loadFactor)
-
-
Method Details
-
createFrom
public static LongIntHppcOpenHashMap createFrom(com.almworks.integers.LongIterable keys, com.almworks.integers.IntIterable values) -
createFrom
-
createForAdd
Creates new hashmap with the specified load factor that is garanteed to not invokeresizeafter addingcountelements- Returns:
- new hashmap with the specified capacity dependent on
countandloadFactor
-
createForAdd
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.LongIntIterator iterator() -
keysIterator
public com.almworks.integers.LongIterator keysIterator() -
valuesIterator
public com.almworks.integers.IntIterator valuesIterator() -
get
public int get(long key) -
clear
public void clear() -
putImpl
protected int putImpl(long key, int value) - Specified by:
putImplin classcom.almworks.integers.AbstractWritableLongIntMap
-
putOrAdd
public int putOrAdd(long 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 ifkeydoes not exist.additionValue- The value to add to the existing value ifkeyexists.- Returns:
- Returns the current value associated with
key(after changes).
-
addTo
public int addTo(long key, int additionValue) -
lget
public int lget()Returns the last value saved in a call tocontainsKey(long).- See Also:
-
lset
public int lset(int value) Sets the value corresponding to the key saved in the last call tocontainsKey(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 returnedtrue. - See Also:
-
removeImpl
protected int removeImpl(long key) - Specified by:
removeImplin classcom.almworks.integers.AbstractWritableLongIntMap
-
remove
public boolean remove(long key, int value) - Specified by:
removein interfacecom.almworks.integers.WritableLongIntMap- Overrides:
removein classcom.almworks.integers.AbstractWritableLongIntMap
-