Top Description Inners Fields Constructors Methods
com.carrotsearch.hppc

public Class SortedIterationShortLongHashMap

extends Object
implements ShortLongMap
Class Inheritance
All Implemented Interfaces
com.carrotsearch.hppc.ShortLongMap, com.carrotsearch.hppc.ShortLongAssociativeContainer, java.lang.Iterable
Annotations
@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 ShortLongHashMap.

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 ShortLongHashMap 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
SortedIterationShortLongHashMap.KeysContainer

A view of the keys in sorted order.

private class
SortedIterationShortLongHashMap.KeysIterator

A sorted iterator over the set of assigned keys.

private class
SortedIterationShortLongHashMap.ValuesContainer

A view of the values in sorted order.

private class
SortedIterationShortLongHashMap.ValuesIterator

A sorted iterator over the set of assigned values.

Field Summary

Modifier and TypeField and Description
public final ShortLongHashMap
public final int[]

Constructor Summary

AccessConstructor and Description
public
SortedIterationShortLongHashMap(ShortLongHashMap delegate, ShortComparator comparator)

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

public
SortedIterationShortLongHashMap(ShortLongHashMap delegate, ShortLongComparator comparator)

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

Method Summary

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

Implements com.carrotsearch.hppc.ShortLongMap.addTo.

An equivalent of calling

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

Implements com.carrotsearch.hppc.ShortLongMap.clear.

Clear all keys and values in the container.

public boolean
containsKey(short key)

Implements com.carrotsearch.hppc.ShortLongAssociativeContainer.containsKey.

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

private int[]
public <T extends ShortLongProcedure> T
forEach(T procedure)

Implements com.carrotsearch.hppc.ShortLongAssociativeContainer.forEach, com.carrotsearch.hppc.ShortLongAssociativeContainer.forEach.

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

public <T extends ShortLongPredicate> T
forEach(T predicate)

Implements com.carrotsearch.hppc.ShortLongAssociativeContainer.forEach, com.carrotsearch.hppc.ShortLongAssociativeContainer.forEach.

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

public long
public long
getOrDefault(short key, long defaultValue)

Implements com.carrotsearch.hppc.ShortLongMap.getOrDefault.

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

Implements com.carrotsearch.hppc.ShortLongMap.indexExists.

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

Implements com.carrotsearch.hppc.ShortLongMap.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
,
short key, long value)

Implements com.carrotsearch.hppc.ShortLongMap.indexInsert.

Inserts a key-value pair for a key that is not present in the map.

public int
indexOf(short
The key to locate in the map.
key
)

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

Implements com.carrotsearch.hppc.ShortLongMap.indexRemove.

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

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

Implements com.carrotsearch.hppc.ShortLongMap.indexReplace.

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

public boolean
public Iterator<ShortLongCursor>
iterator()

Implements com.carrotsearch.hppc.ShortLongAssociativeContainer.iterator.

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

public ShortCollection
keys()

Implements com.carrotsearch.hppc.ShortLongAssociativeContainer.keys.

Returns a collection of keys of this container.

public long
put(short key, long value)

Implements com.carrotsearch.hppc.ShortLongMap.put.

Place a given key and value in the container.

public int
putAll(ShortLongAssociativeContainer container)

Implements com.carrotsearch.hppc.ShortLongMap.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 ShortLongCursor> iterable)

Implements com.carrotsearch.hppc.ShortLongMap.putAll.

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

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

Implements com.carrotsearch.hppc.ShortLongMap.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.ShortLongMap.release.

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

public long
remove(short key)

Implements com.carrotsearch.hppc.ShortLongMap.remove.

Remove all values at the given key.

public int
removeAll(ShortContainer container)

Implements com.carrotsearch.hppc.ShortLongAssociativeContainer.removeAll.

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

public int
removeAll(ShortPredicate predicate)

Implements com.carrotsearch.hppc.ShortLongAssociativeContainer.removeAll.

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

public int
removeAll(ShortLongPredicate predicate)

Implements com.carrotsearch.hppc.ShortLongAssociativeContainer.removeAll.

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

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

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

protected int[]
sortIterationOrder(int[] entryIndexes, ShortLongComparator comparator)

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

public LongContainer
values()

Implements com.carrotsearch.hppc.ShortLongAssociativeContainer.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.ShortLongMap.visualizeKeyDistribution.

Visually depict the distribution of keys.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait