Object to long, implemented using open addressing with
linear probing for collision resolution. Supports null key.
| Modifier and Type | Class and Description |
|---|---|
| private class | ObjectLongHashMap.
An iterator implementation for |
| public class | ObjectLongHashMap.
A view of the keys inside this hash map. |
| private class | ObjectLongHashMap.
An iterator over the set of assigned keys. |
| private class | ObjectLongHashMap.
A view over the set of values of this map. |
| private class | ObjectLongHashMap.
An iterator over the set of assigned values. |
| Modifier and Type | Field and Description |
|---|---|
| protected int | |
| protected boolean | hasEmptyKey
Special treatment for the "empty slot" key marker. |
| protected int | iterationSeed
Seed used to ensure the hash iteration order is different from an iteration to another. |
| public Object[] | keys
The array holding keys. |
| protected double | loadFactor
The load factor for |
| protected int | |
| protected int | |
| public long[] | values
The array holding values. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ObjectLongHashMap(int
The expected number of elements guaranteed not to cause buffer
expansion (inclusive). expectedElements)New instance with sane defaults. |
| public | ObjectLongHashMap(int
The expected number of elements guaranteed not to cause a rehash
(inclusive). expectedElements, double The load factor for internal buffers. Insane load factors (zero, full
capacity) are rejected by loadFactor)verifyLoadFactor(double).New instance with the provided defaults. |
| public | ObjectLongHashMap(ObjectLongAssociativeContainer<? extends KType> container)
Create a hash map from all key-value pairs of another container. |
| Modifier and Type | Method and Description |
|---|---|
| public long | Returns: Returns the current value associated withkey (after changes).The key of the value to adjust. key, long The value to put or add to the existing value if incrementValue)key exists.Implements com. Adds |
| protected void | |
| protected void | allocateThenInsertThenRehash(int slot, KType pendingKey, long pendingValue)
This method is invoked when there is a new key/ value pair to be inserted into the buffers but there is not enough empty slots to do so. |
| public void | clear()
Implements com. Clear all keys and values in the container. |
| public ObjectLongHashMap | |
| public boolean | containsKey(KType key)
Implements com. Returns |
| public void | ensureCapacity(int
The total number of keys, inclusive. expectedElements)Implements com. Ensure this container can hold at least the given number of keys (entries) without resizing its buffers. |
| protected boolean | equalElements(ObjectLongHashMap<?> other)
Return true if all keys of some other container exist in this container. |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Implements com. Compares the specified object with this set for equality. |
| protected boolean | |
| public <T extends ObjectLongProcedure | forEach(T procedure)
Implements com. Applies a given procedure to all keys-value pairs in this container. |
| public <T extends ObjectLongPredicate | forEach(T predicate)
Implements com. Applies a given procedure to all keys-value pairs in this container. |
| public static <KType> ObjectLongHashMap | from(KType[] keys, long[] values)
Creates a hash map from two index-aligned arrays of key-value pairs. |
| public long | |
| public long | getOrDefault(KType key, long defaultValue)
Implements com.
|
| public int | hashCode()
Overrides java. Implements com. Returns a hash code value for this object. |
| protected int | |
| public boolean | indexExists(int
The index of a given key, as returned from index)indexOf.Implements com.
|
| public long | indexGet(int
The index of an existing key. index)Implements com. Returns the value associated with an existing key. |
| public void | indexInsert(int
The index of a previously non-existing key, as returned from index, KType key, long value)indexOf.Implements com. Inserts a key-value pair for a key that is not present in the map. |
| public int | indexOf(KType
The key to locate in the map. key)Implements com. Returns a logical "index" of a given key that can be used to speed up follow-up value setters or getters in certain scenarios (conditional logic). |
| public long | indexRemove(int
The index of the key to remove, as returned from index)indexOf.Implements com. Removes a key-value pair at an index previously acquired from |
| public long | indexReplace(int
The index of an existing key. index, long newValue)Implements com. Replaces the value associated with an existing key and returns any previous value stored for that key. |
| public boolean | |
| public Iterator | iterator()
Implements com. Returns a cursor over the entries (key-value pairs) in this map. |
| public ObjectLongHashMap | keys()
Implements com. Returns a specialized view of the keys of this associated container. |
| protected int | nextIterationSeed()
Provides the next iteration seed used to build the iteration starting slot and offset increment. |
| public long | put(KType key, long value)
Implements com. Place a given key and value in the container. |
| public int | putAll(ObjectLongAssociativeContainer<? extends KType> container)
Implements com. Puts all keys from another container to this map, replacing the values of existing keys, if such keys are present. |
| public int | putAll(Iterable<? extends ObjectLongCursor<? extends KType>> iterable)
Implements com. Puts all key/value pairs from a given iterable into this map. |
| public long | Returns: Returns the current value associated withkey (after changes).The key of the value to adjust. key, long The value to put if putValue, long key does not exist.The value to add to the existing value if incrementValue)key exists.Implements com. If |
| public long | ramBytesAllocated()
Implements com. Allocated memory estimation |
| public long | ramBytesUsed()
Implements com. Bytes that is actually been used |
| protected void | |
| public void | release()
Implements com. Removes all elements from the collection and additionally releases any internal buffers. |
| public long | remove(KType key)
Implements com. Remove all values at the given key. |
| public int | removeAll(ObjectContainer<? super KType> other)
Implements com. Removes all keys (and associated values) present in a given container. |
| public int | removeAll(ObjectLongPredicate<? super KType> predicate)
Implements com. Removes all keys (and associated values) for which the predicate returns |
| public int | removeAll(ObjectPredicate<? super KType> predicate)
Implements com. Removes all keys (and associated values) for which the predicate returns |
| protected void | shiftConflictingKeys(int gapSlot)
Shift all the slot-conflicting keys and values allocated to (and including) |
| public int | |
| public String | toString()
Overrides java. Convert the contents of this map to a human-friendly string. |
| public LongCollection | Returns: Returns a container with all values stored in this map.Implements com. Returns a container view of all values present in this container. |
| protected double | |
| public String | visualizeKeyDistribution(int
The number of characters to "squeeze" the entire buffer into. characters)Implements com. Visually depict the distribution of keys. |