Top Description Inners Fields Constructors Methods
com.carrotsearch.hppc

public Class SortedIterationObjectCharHashMap<KType>

extends Object
implements ObjectCharMap<KType>
Class Inheritance
All Implemented Interfaces
com.carrotsearch.hppc.ObjectCharMap, com.carrotsearch.hppc.ObjectCharAssociativeContainer, 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.Comparator, .Iterator, java.util.function.IntBinaryOperator

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

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 ObjectCharHashMap 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
SortedIterationObjectCharHashMap.KeysContainer

A view of the keys in sorted order.

private class
SortedIterationObjectCharHashMap.KeysIterator

A sorted iterator over the set of assigned keys.

private class
SortedIterationObjectCharHashMap.ValuesContainer

A view of the values in sorted order.

private class
SortedIterationObjectCharHashMap.ValuesIterator

A sorted iterator over the set of assigned values.

Field Summary

Modifier and TypeField and Description
public final ObjectCharHashMap<KType>
public final int[]

Constructor Summary

AccessConstructor and Description
public
SortedIterationObjectCharHashMap(ObjectCharHashMap<KType> delegate, Comparator<KType> comparator)

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

public
SortedIterationObjectCharHashMap(ObjectCharHashMap<KType> delegate, ObjectCharComparator<KType> comparator)

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

Method Summary

Modifier and TypeMethod and Description
public char
addTo(KType
The key of the value to adjust.
key
,
char
The value to put or add to the existing value if key exists.
additionValue
)

Implements com.carrotsearch.hppc.ObjectCharMap.addTo.

An equivalent of calling

putOrAdd(key, additionValue, additionValue);
private boolean
public void
clear()

Implements com.carrotsearch.hppc.ObjectCharMap.clear.

Clear all keys and values in the container.

public boolean
containsKey(KType key)

Implements com.carrotsearch.hppc.ObjectCharAssociativeContainer.containsKey.

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

private int[]
public <T extends ObjectCharProcedure<? super KType>> T
forEach(T procedure)

Implements com.carrotsearch.hppc.ObjectCharAssociativeContainer.forEach, com.carrotsearch.hppc.ObjectCharAssociativeContainer.forEach.

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

public <T extends ObjectCharPredicate<? super KType>> T
forEach(T predicate)

Implements com.carrotsearch.hppc.ObjectCharAssociativeContainer.forEach, com.carrotsearch.hppc.ObjectCharAssociativeContainer.forEach.

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

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

Implements com.carrotsearch.hppc.ObjectCharMap.getOrDefault.

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

Implements com.carrotsearch.hppc.ObjectCharMap.indexExists.

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

Implements com.carrotsearch.hppc.ObjectCharMap.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
,
KType key, char value)

Implements com.carrotsearch.hppc.ObjectCharMap.indexInsert.

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.carrotsearch.hppc.ObjectCharMap.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 char
indexRemove(int
The index of the key to remove, as returned from indexOf.
index
)

Implements com.carrotsearch.hppc.ObjectCharMap.indexRemove.

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

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

Implements com.carrotsearch.hppc.ObjectCharMap.indexReplace.

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

public boolean
public Iterator<ObjectCharCursor<KType>>
iterator()

Implements com.carrotsearch.hppc.ObjectCharAssociativeContainer.iterator.

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

public ObjectCollection<KType>
keys()

Implements com.carrotsearch.hppc.ObjectCharAssociativeContainer.keys.

Returns a collection of keys of this container.

public char
put(KType key, char value)

Implements com.carrotsearch.hppc.ObjectCharMap.put.

Place a given key and value in the container.

public int
putAll(ObjectCharAssociativeContainer<? extends KType> container)

Implements com.carrotsearch.hppc.ObjectCharMap.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 ObjectCharCursor<? extends KType>> iterable)

Implements com.carrotsearch.hppc.ObjectCharMap.putAll.

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

public char
putOrAdd(KType
The key of the value to adjust.
key
,
char
The value to put if key does not exist.
putValue
,
char
The value to add to the existing value if key exists.
incrementValue
)

Implements com.carrotsearch.hppc.ObjectCharMap.putOrAdd.

If key exists, putValue is inserted into the map, otherwise any existing value is incremented by additionValue.

private static RuntimeException
public void
release()

Implements com.carrotsearch.hppc.ObjectCharMap.release.

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

public char
remove(KType key)

Implements com.carrotsearch.hppc.ObjectCharMap.remove.

Remove all values at the given key.

public int
removeAll(ObjectContainer<? super KType> container)

Implements com.carrotsearch.hppc.ObjectCharAssociativeContainer.removeAll.

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

public int
removeAll(ObjectPredicate<? super KType> predicate)

Implements com.carrotsearch.hppc.ObjectCharAssociativeContainer.removeAll.

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

public int
removeAll(ObjectCharPredicate<? super KType> predicate)

Implements com.carrotsearch.hppc.ObjectCharAssociativeContainer.removeAll.

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

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, ObjectCharComparator<KType> comparator)

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

public CharContainer
values()

Implements com.carrotsearch.hppc.ObjectCharAssociativeContainer.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.ObjectCharMap.visualizeKeyDistribution.

Visually depict the distribution of keys.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait