char to Object, implemented using open addressing with
linear probing for collision resolution. Supports null values.
| Modifier and Type | Class and Description |
|---|---|
| private class | CharObjectHashMap.
An iterator implementation for |
| public class | CharObjectHashMap.
A view of the keys inside this hash map. |
| private class | CharObjectHashMap.
An iterator over the set of assigned keys. |
| private class | CharObjectHashMap.
A view over the set of values of this map. |
| private class | CharObjectHashMap.
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 char[] | keys
The array holding keys. |
| protected double | loadFactor
The load factor for |
| protected int | |
| protected int | |
| public Object[] | values
The array holding values. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CharObjectHashMap(int
The expected number of elements guaranteed not to cause buffer
expansion (inclusive). expectedElements)New instance with sane defaults. |
| public | CharObjectHashMap(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 | CharObjectHashMap(CharObjectAssociativeContainer<? extends VType> container)
Create a hash map from all key-value pairs of another container. |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected void | allocateThenInsertThenRehash(int slot, char pendingKey, VType 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 CharObjectHashMap | |
| public boolean | containsKey(char 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(CharObjectHashMap<?> 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. |
| public <T extends CharObjectProcedure | forEach(T procedure)
Implements com. Applies a given procedure to all keys-value pairs in this container. |
| public <T extends CharObjectPredicate | forEach(T predicate)
Implements com. Applies a given procedure to all keys-value pairs in this container. |
| public static <VType> CharObjectHashMap | from(char[] keys, VType[] values)
Creates a hash map from two index-aligned arrays of key-value pairs. |
| public VType | |
| public VType | getOrDefault(char key, VType 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 VType | 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, char key, VType value)indexOf.Implements com. Inserts a key-value pair for a key that is not present in the map. |
| public int | indexOf(char
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 VType | 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 VType | indexReplace(int
The index of an existing key. index, VType 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 CharObjectHashMap | 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 VType | put(char key, VType value)
Implements com. Place a given key and value in the container. |
| public int | putAll(CharObjectAssociativeContainer<? extends VType> 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 CharObjectCursor<? extends VType>> iterable)
Implements com. Puts all key/value pairs from a given iterable into this map. |
| 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 VType | remove(char key)
Implements com. Remove all values at the given key. |
| public int | removeAll(CharContainer other)
Implements com. Removes all keys (and associated values) present in a given container. |
| public int | removeAll(CharObjectPredicate<? super VType> predicate)
Implements com. Removes all keys (and associated values) for which the predicate returns |
| public int | removeAll(CharPredicate 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 ObjectCollection | 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. |