ObjectIntHashMap.
In its constructor, this view creates its own iteration order array and sorts it, which is in O(n.log(n)) of the size of the delegate map. Afterward, calls to any method have the same performance as the delegate map.
This view is read-only. In addition, the delegate map must not be modified while the view is used, otherwise the iteration is undefined.
Since this view provides a fixed iteration order, it must not be used to add entries to
another ObjectIntHashMap as this may result in a runtime deadlock. See HPPC-103 and HPPC-186 for more information.
| Modifier and Type | Class and Description |
|---|---|
| private class | SortedIterationObjectIntHashMap.
An iterator implementation for |
| private class | SortedIterationObjectIntHashMap.
A view of the keys in sorted order. |
| private class | SortedIterationObjectIntHashMap.
A sorted iterator over the set of assigned keys. |
| private class | SortedIterationObjectIntHashMap.
A view of the values in sorted order. |
| private class | SortedIterationObjectIntHashMap.
A sorted iterator over the set of assigned values. |
| Modifier and Type | Field and Description |
|---|---|
| public final ObjectIntHashMap | |
| public final int[] |
| Access | Constructor and Description |
|---|---|
| public | SortedIterationObjectIntHashMap(ObjectIntHashMap<KType> delegate, Comparator<KType> comparator)
Creates a read-only view with sorted iteration order on the given delegate map. |
| public | SortedIterationObjectIntHashMap(ObjectIntHashMap<KType> delegate, ObjectIntComparator<KType> comparator)
Creates a read-only view with sorted iteration order on the given delegate map. |
| Modifier and Type | Method and Description |
|---|---|
| public int | addTo(KType
The key of the value to adjust. key, int The value to put or add to the existing value if additionValue)key exists.Implements com. An equivalent of calling putOrAdd(key, additionValue, additionValue); |
| private boolean | |
| public void | clear()
Implements com. Clear all keys and values in the container. |
| public boolean | containsKey(KType key)
Implements com. Returns |
| private int[] | |
| public <T extends ObjectIntProcedure | forEach(T procedure)
Implements com. Applies a given procedure to all keys-value pairs in this container. |
| public <T extends ObjectIntPredicate | forEach(T predicate)
Implements com. Applies a given procedure to all keys-value pairs in this container. |
| public int | |
| public int | getOrDefault(KType key, int defaultValue)
Implements com.
|
| public boolean | indexExists(int
The index of a given key, as returned from index)indexOf.Implements com.
|
| public int | 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, int 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 int | 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 int | indexReplace(int
The index of an existing key. index, int 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 ObjectCollection | keys()
Implements com. Returns a collection of keys of this container. |
| public int | put(KType key, int value)
Implements com. Place a given key and value in the container. |
| public int | putAll(ObjectIntAssociativeContainer<? 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 ObjectIntCursor<? extends KType>> iterable)
Implements com. Puts all keys from an iterable cursor to this map, replacing the values of existing keys, if such keys are present. |
| public int | putOrAdd(KType
The key of the value to adjust. key, int The value to put if putValue, int key does not exist.The value to add to the existing value if incrementValue)key exists.Implements com. If |
| private static RuntimeException | |
| public void | release()
Implements com. Removes all elements from the collection and additionally releases any internal buffers. |
| public int | remove(KType key)
Implements com. Remove all values at the given key. |
| public int | removeAll(ObjectContainer<? super KType> container)
Implements com. Removes all keys (and associated values) present in a given container. |
| public int | removeAll(ObjectPredicate<? super KType> predicate)
Implements com. Removes all keys (and associated values) for which the predicate returns |
| public int | removeAll(ObjectIntPredicate<? super KType> predicate)
Implements com. Removes all keys (and associated values) for which the predicate returns |
| public int | |
| protected int[] | sortIterationOrder(int[] entryIndexes, Comparator<KType> comparator)
Sort the iteration order array based on the provided comparator on the keys. |
| protected int[] | sortIterationOrder(int[] entryIndexes, ObjectIntComparator<KType> comparator)
Sort the iteration order array based on the provided comparator on keys and values. |
| public IntContainer | values()
Implements com. Returns a container view of all values present in this container. |
| public String | visualizeKeyDistribution(int
The number of characters to "squeeze" the entire buffer into. characters)Implements com. Visually depict the distribution of keys. |