Top Description Inners Fields Constructors Methods
com.carrotsearch.hppc

public Class SortedIterationCharObjectHashMap<VType>

extends Object
implements CharObjectMap<VType>
Class Inheritance
All Implemented Interfaces
com.carrotsearch.hppc.CharObjectMap, com.carrotsearch.hppc.CharObjectAssociativeContainer, java.lang.Iterable
Annotations
@SuppressWarnings:unchecked
@Generated:SortedIterationKTypeVTypeHashMap.java
date:2024-06-04T15:20:17+0200
Imports
com.carrotsearch.hppc.comparators.*, com.carrotsearch.hppc.cursors.*, com.carrotsearch.hppc.predicates.*, com.carrotsearch.hppc.procedures.*, com.carrotsearch.hppc.sorting.QuickSort, java.util.Iterator, java.util.function.IntBinaryOperator

Read-only view with sorted iteration order on a delegate CharObjectHashMap.

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 CharObjectHashMap as this may result in a runtime deadlock. See HPPC-103 and HPPC-186 for more information.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class
SortedIterationCharObjectHashMap.KeysContainer

A view of the keys in sorted order.

private class
SortedIterationCharObjectHashMap.KeysIterator

A sorted iterator over the set of assigned keys.

private class
SortedIterationCharObjectHashMap.ValuesContainer

A view of the values in sorted order.

private class
SortedIterationCharObjectHashMap.ValuesIterator

A sorted iterator over the set of assigned values.

Field Summary

Modifier and TypeField and Description
public final CharObjectHashMap<VType>
public final int[]

Constructor Summary

AccessConstructor and Description
public
SortedIterationCharObjectHashMap(CharObjectHashMap<VType> delegate, CharComparator comparator)

Creates a read-only view with sorted iteration order on the given delegate map.

public
SortedIterationCharObjectHashMap(CharObjectHashMap<VType> delegate, CharObjectComparator<VType> comparator)

Creates a read-only view with sorted iteration order on the given delegate map.

Method Summary

Modifier and TypeMethod and Description
private boolean
public void
clear()

Implements com.carrotsearch.hppc.CharObjectMap.clear.

Clear all keys and values in the container.

public boolean
containsKey(char key)

Implements com.carrotsearch.hppc.CharObjectAssociativeContainer.containsKey.

Returns true if this container has an association to a value for the given key.

private int[]
public <T extends CharObjectProcedure<? super VType>> T
forEach(T procedure)

Implements com.carrotsearch.hppc.CharObjectAssociativeContainer.forEach, com.carrotsearch.hppc.CharObjectAssociativeContainer.forEach.

Applies a given procedure to all keys-value pairs in this container.

public <T extends CharObjectPredicate<? super VType>> T
forEach(T predicate)

Implements com.carrotsearch.hppc.CharObjectAssociativeContainer.forEach, com.carrotsearch.hppc.CharObjectAssociativeContainer.forEach.

Applies a given procedure to all keys-value pairs in this container.

public VType
public VType
getOrDefault(char key, VType defaultValue)

Implements com.carrotsearch.hppc.CharObjectMap.getOrDefault.

public boolean
indexExists(int
The index of a given key, as returned from indexOf.
index
)

Implements com.carrotsearch.hppc.CharObjectMap.indexExists.

public VType
indexGet(int
The index of an existing key.
index
)

Implements com.carrotsearch.hppc.CharObjectMap.indexGet.

Returns the value associated with an existing key.

public void
indexInsert(int
The index of a previously non-existing key, as returned from indexOf.
index
,
char key, VType value)

Implements com.carrotsearch.hppc.CharObjectMap.indexInsert.

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.carrotsearch.hppc.CharObjectMap.indexOf.

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 indexOf.
index
)

Implements com.carrotsearch.hppc.CharObjectMap.indexRemove.

Removes a key-value pair at an index previously acquired from indexOf.

public VType
indexReplace(int
The index of an existing key.
index
,
VType newValue)

Implements com.carrotsearch.hppc.CharObjectMap.indexReplace.

Replaces the value associated with an existing key and returns any previous value stored for that key.

public boolean
public Iterator<CharObjectCursor<VType>>
iterator()

Implements com.carrotsearch.hppc.CharObjectAssociativeContainer.iterator.

Returns a cursor over the entries (key-value pairs) in this map.

public CharCollection
keys()

Implements com.carrotsearch.hppc.CharObjectAssociativeContainer.keys.

Returns a collection of keys of this container.

public VType
put(char key, VType value)

Implements com.carrotsearch.hppc.CharObjectMap.put.

Place a given key and value in the container.

public int
putAll(CharObjectAssociativeContainer<? extends VType> container)

Implements com.carrotsearch.hppc.CharObjectMap.putAll.

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.carrotsearch.hppc.CharObjectMap.putAll.

Puts all keys from an iterable cursor to this map, replacing the values of existing keys, if such keys are present.

private static RuntimeException
public void
release()

Implements com.carrotsearch.hppc.CharObjectMap.release.

Removes all elements from the collection and additionally releases any internal buffers.

public VType
remove(char key)

Implements com.carrotsearch.hppc.CharObjectMap.remove.

Remove all values at the given key.

public int
removeAll(CharContainer container)

Implements com.carrotsearch.hppc.CharObjectAssociativeContainer.removeAll.

Removes all keys (and associated values) present in a given container.

public int
removeAll(CharPredicate predicate)

Implements com.carrotsearch.hppc.CharObjectAssociativeContainer.removeAll.

Removes all keys (and associated values) for which the predicate returns true.

public int
removeAll(CharObjectPredicate<? super VType> predicate)

Implements com.carrotsearch.hppc.CharObjectAssociativeContainer.removeAll.

Removes all keys (and associated values) for which the predicate returns true.

public int
protected int[]
sortIterationOrder(int[] entryIndexes, CharComparator comparator)

Sort the iteration order array based on the provided comparator on the keys.

protected int[]
sortIterationOrder(int[] entryIndexes, CharObjectComparator<VType> comparator)

Sort the iteration order array based on the provided comparator on keys and values.

public ObjectContainer<VType>
values()

Implements com.carrotsearch.hppc.CharObjectAssociativeContainer.values.

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.carrotsearch.hppc.CharObjectMap.visualizeKeyDistribution.

Visually depict the distribution of keys.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait