Package com.almworks.integers.wrappers
Class IntLongHppcOpenHashMap
java.lang.Object
com.almworks.integers.AbstractWritableIntLongMap
com.almworks.integers.wrappers.IntLongHppcOpenHashMap
- All Implemented Interfaces:
com.almworks.integers.IntLongIterable,com.almworks.integers.IntLongMap,com.almworks.integers.WritableIntLongMap,Iterable<com.almworks.integers.IntLongIterator>
public class IntLongHppcOpenHashMap
extends com.almworks.integers.AbstractWritableIntLongMap
-
Field Summary
FieldsFields inherited from class com.almworks.integers.AbstractWritableIntLongMap
myModCountFields inherited from interface com.almworks.integers.IntLongMap
DEFAULT_VALUE, EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionIntLongHppcOpenHashMap(int initialCapacity) IntLongHppcOpenHashMap(int initialCapacity, float loadFactor) -
Method Summary
Modifier and TypeMethodDescriptionlongaddTo(int key, long additionValue) voidclear()booleancontainsKey(int key) static IntLongHppcOpenHashMapcreateForAdd(int count) Creates new hashmap with default load factorstatic IntLongHppcOpenHashMapcreateForAdd(int count, float loadFactor) Creates new hashmap with the specified load factor that is garanteed to not invokeresizeafter addingcountelementsstatic IntLongHppcOpenHashMapcreateFrom(int[] keys, long[] values) static IntLongHppcOpenHashMapcreateFrom(com.almworks.integers.IntIterable keys, com.almworks.integers.LongIterable values) longget(int key) @NotNull com.almworks.integers.IntLongIteratoriterator()com.almworks.integers.IntIteratorlonglget()Returns the last value saved in a call tocontainsKey(int).longlset(long value) Sets the value corresponding to the key saved in the last call tocontainsKey(int), if and only if the key exists in the map already.intlslot()protected longputImpl(int key, long value) longputOrAdd(int key, long putValue, long additionValue) Trove-inspired API method.booleanremove(int key, long value) protected longremoveImpl(int key) intsize()com.almworks.integers.LongIteratorMethods inherited from class com.almworks.integers.AbstractWritableIntLongMap
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.IntLongOpenHashMap myMap
-
-
Constructor Details
-
IntLongHppcOpenHashMap
public IntLongHppcOpenHashMap() -
IntLongHppcOpenHashMap
public IntLongHppcOpenHashMap(int initialCapacity) -
IntLongHppcOpenHashMap
public IntLongHppcOpenHashMap(int initialCapacity, float loadFactor)
-
-
Method Details
-
createFrom
public static IntLongHppcOpenHashMap createFrom(com.almworks.integers.IntIterable keys, com.almworks.integers.LongIterable 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(int key) -
size
public int size() -
iterator
@NotNull public @NotNull com.almworks.integers.IntLongIterator iterator() -
keysIterator
public com.almworks.integers.IntIterator keysIterator() -
valuesIterator
public com.almworks.integers.LongIterator valuesIterator() -
get
public long get(int key) -
clear
public void clear() -
putImpl
protected long putImpl(int key, long value) - Specified by:
putImplin classcom.almworks.integers.AbstractWritableIntLongMap
-
putOrAdd
public long putOrAdd(int 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 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 long addTo(int key, long additionValue) -
lget
public long lget()Returns the last value saved in a call tocontainsKey(int).- See Also:
-
lset
public long lset(long value) Sets the value corresponding to the key saved in the last call tocontainsKey(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 returnedtrue. - See Also:
-
removeImpl
protected long removeImpl(int key) - Specified by:
removeImplin classcom.almworks.integers.AbstractWritableIntLongMap
-
remove
public boolean remove(int key, long value) - Specified by:
removein interfacecom.almworks.integers.WritableIntLongMap- Overrides:
removein classcom.almworks.integers.AbstractWritableIntLongMap
-