# ⬢ collections 25.6.0-elide.4 Every page: [llms.txt](llms.txt), or all in one file: [llms-full.txt](llms-full.txt) API reference for collections. ## Packages - [`org.graalvm.collections`](org/graalvm/collections/index.md): The GraalVM SDK collections package contains memory efficient data structures. ## Types in `org.graalvm.collections` - [`EconomicMap`](org/graalvm/collections/EconomicMap.md) (interface): Memory efficient map data structure that dynamically changes its representation depending on the number of entries and is specially optimized for small number of entries. - [`EconomicMapUtil`](org/graalvm/collections/EconomicMapUtil.md) (class): Utility methods for the EconomicMap. - [`EconomicMapWrap`](org/graalvm/collections/EconomicMapWrap.md) (class): Wraps an existing Map as an EconomicMap. - [`EconomicSet`](org/graalvm/collections/EconomicSet.md) (interface): Memory efficient set data structure. - [`Equivalence`](org/graalvm/collections/Equivalence.md) (abstract class): Strategy for comparing two objects. - [`LockFreePool`](org/graalvm/collections/LockFreePool.md) (class): Concurrent lock-free pool data structure. - [`LockFreePrefixTree`](org/graalvm/collections/LockFreePrefixTree.md) (class): Thread-safe and lock-free prefix-tree implementation in which keys are sequences of 64-bit values, and the values are 64-bit values. - [`LockFreePrefixTree.Allocator`](org/graalvm/collections/LockFreePrefixTree.Allocator.md) (abstract class): Policy for allocating objects of the lock-free prefix tree. - [`LockFreePrefixTree.HeapAllocator`](org/graalvm/collections/LockFreePrefixTree.HeapAllocator.md) (class): Allocator that allocates objects directly on the managed heap. - [`LockFreePrefixTree.Node`](org/graalvm/collections/LockFreePrefixTree.Node.md) (class): No description. - [`LockFreePrefixTree.ObjectPoolingAllocator`](org/graalvm/collections/LockFreePrefixTree.ObjectPoolingAllocator.md) (class): Allocator that internally maintains several pools of preallocated objects, and allocates objects from those pools. - [`MapCursor`](org/graalvm/collections/MapCursor.md) (interface): Cursor to iterate over a mutable map. - [`Pair`](org/graalvm/collections/Pair.md) (class): Utility class representing a pair of values. - [`SeqLockPrefixTree`](org/graalvm/collections/SeqLockPrefixTree.md) (class): Thread-safe prefix-tree implementation in which keys are sequences of 64-bit values, and the values are 64-bit values. - [`SeqLockPrefixTree.Node`](org/graalvm/collections/SeqLockPrefixTree.Node.md) (class): No description. - [`UnmodifiableEconomicMap`](org/graalvm/collections/UnmodifiableEconomicMap.md) (interface): Unmodifiable memory efficient map. - [`UnmodifiableEconomicSet`](org/graalvm/collections/UnmodifiableEconomicSet.md) (interface): Unmodifiable memory efficient set data structure. - [`UnmodifiableMapCursor`](org/graalvm/collections/UnmodifiableMapCursor.md) (interface): Cursor to iterate over a map without changing its contents. # ▣ org.graalvm.collections [collections](index.md) · Every page: [llms.txt](llms.txt) Package in collections. Since 19.0. The GraalVM SDK collections package contains memory efficient data structures. **See also** - [`org.graalvm.collections.EconomicMap`](org/graalvm/collections/EconomicMap.md) - [`org.graalvm.collections.EconomicSet`](org/graalvm/collections/EconomicSet.md) ## Interfaces - [`EconomicMap`](org/graalvm/collections/EconomicMap.md): Memory efficient map data structure that dynamically changes its representation depending on the number of entries and is specially optimized for small number of entries. - [`EconomicSet`](org/graalvm/collections/EconomicSet.md): Memory efficient set data structure. - [`MapCursor`](org/graalvm/collections/MapCursor.md): Cursor to iterate over a mutable map. - [`UnmodifiableEconomicMap`](org/graalvm/collections/UnmodifiableEconomicMap.md): Unmodifiable memory efficient map. - [`UnmodifiableEconomicSet`](org/graalvm/collections/UnmodifiableEconomicSet.md): Unmodifiable memory efficient set data structure. - [`UnmodifiableMapCursor`](org/graalvm/collections/UnmodifiableMapCursor.md): Cursor to iterate over a map without changing its contents. ## Classes - [`EconomicMapUtil`](org/graalvm/collections/EconomicMapUtil.md): Utility methods for the EconomicMap. - [`EconomicMapWrap`](org/graalvm/collections/EconomicMapWrap.md): Wraps an existing Map as an EconomicMap. - [`Equivalence`](org/graalvm/collections/Equivalence.md): Strategy for comparing two objects. - [`LockFreePool`](org/graalvm/collections/LockFreePool.md): Concurrent lock-free pool data structure. - [`LockFreePrefixTree`](org/graalvm/collections/LockFreePrefixTree.md): Thread-safe and lock-free prefix-tree implementation in which keys are sequences of 64-bit values, and the values are 64-bit values. - [`Pair`](org/graalvm/collections/Pair.md): Utility class representing a pair of values. - [`SeqLockPrefixTree`](org/graalvm/collections/SeqLockPrefixTree.md): Thread-safe prefix-tree implementation in which keys are sequences of 64-bit values, and the values are 64-bit values. # ◇ EconomicMap [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Interface in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 19.0. ```java public interface EconomicMap extends UnmodifiableEconomicMap ``` Extends: [`UnmodifiableEconomicMap`](org/graalvm/collections/UnmodifiableEconomicMap.md)`` Memory efficient map data structure that dynamically changes its representation depending on the number of entries and is specially optimized for small number of entries. It keeps elements in a linear list without any hashing when the number of entries is small. Should an actual hash data structure be necessary, it tries to fit the hash value into as few bytes as possible. In contrast to [`java.util.HashMap`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/HashMap.html), it avoids allocating an extra node object per entry and rather keeps values always in a plain array. See `EconomicMapImpl` for implementation details and exact thresholds when its representation changes. It supports a `null` value, but it does not support adding or looking up a `null` key. Operations `get` and `put` provide constant-time performance on average if repeatedly performed. They can however trigger an operation growing or compressing the data structure, which is linear in the number of elements. Iteration is also linear in the number of elements. The implementation is not synchronized. If multiple threads want to access the data structure, it requires manual synchronization, for example using [`java.util.Collections.synchronizedMap`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Collections.html#synchronizedMap%28java.util.Map%29). There is also no extra precaution to detect concurrent modification while iterating. Different strategies for the equality comparison can be configured by providing a [`Equivalence`](org/graalvm/collections/Equivalence.md) configuration object. ## Methods ### put(K, V) `V put(K key, V value)`. Since 19.0. Associates `value` with `key` in this map. If the map previously contained a mapping for `key`, the old value is replaced by `value`. While the `value` may be `null`, the `key` must not be {code null}. Returns `V`: the previous value associated with `key`, or `null` if there was no mapping for `key`. Throws: `UnsupportedOperationException` (unchecked): if `key == null`. Cite: `org/graalvm/collections/EconomicMap.html#put(K,V)` ### putIfAbsent(K, V) `default V putIfAbsent(K key, V value)`. Since 20.2. If the specified key is not already associated with a value (or is mapped to `null`) associates it with the given value and returns `null`, else returns the current value. Parameters: `key` `K`: non-null key with which the specified value is to be associated. `value` `V`: value to be associated with the specified key. Returns `V`: the previous value associated with the specified key, or `null` if there was no mapping for the key. (A `null` return can also indicate that the map previously associated `null` with the key, if the implementation supports null values.). Throws: `UnsupportedOperationException` (unchecked): if `key == null`. Cite: `org/graalvm/collections/EconomicMap.html#putIfAbsent(K,V)` ### putAll(EconomicMap) `default void putAll(EconomicMap other)`. Since 19.0. Copies all the mappings from `other` to this map. Cite: `org/graalvm/collections/EconomicMap.html#putAll(org.graalvm.collections.EconomicMap)` ### putAll(UnmodifiableEconomicMap) `default void putAll(UnmodifiableEconomicMap other)`. Since 19.0. Copies all the mappings from `other` to this map. Cite: `org/graalvm/collections/EconomicMap.html#putAll(org.graalvm.collections.UnmodifiableEconomicMap)` ### clear() `void clear()`. Since 19.0. Removes all the mappings from this map. The map will be empty after this call returns. Cite: `org/graalvm/collections/EconomicMap.html#clear()` ### removeKey(K) `V removeKey(K key)`. Since 19.0. Removes the mapping for `key` from this map if it is present. The map will not contain a mapping for `key` once the call returns. The `key` must not be `null`. Returns `V`: the previous value associated with `key`, or `null` if there was no mapping for `key`. Cite: `org/graalvm/collections/EconomicMap.html#removeKey(K)` ### getEntries() `MapCursor getEntries()`. Since 19.0. Returns a `MapCursor` view of the mappings contained in this map. Overrides `getEntries()`. Cite: `org/graalvm/collections/EconomicMap.html#getEntries()` ### replaceAll(BiFunction) `void replaceAll(BiFunction function)`. Since 19.0. Replaces each entry's value with the result of invoking `function` on that entry until all entries have been processed or the function throws an exception. Exceptions thrown by the function are relayed to the caller. Cite: `org/graalvm/collections/EconomicMap.html#replaceAll(java.util.function.BiFunction)` ### trimToSize() `default void trimToSize()`. Since 25.1. Trims any implementation-specific storage so it does not retain unused capacity. This method does not change the mappings in this map. Implementations that do not retain trimmable storage may leave this method as a no-op. Cite: `org/graalvm/collections/EconomicMap.html#trimToSize()` ### create() `static EconomicMap create()`. Since 19.0. Creates a new map that guarantees insertion order on the key set with the default `Equivalence.DEFAULT` comparison strategy for keys. Cite: `org/graalvm/collections/EconomicMap.html#create()` ### create(int) `static EconomicMap create(int initialCapacity)`. Since 19.0. Creates a new map that guarantees insertion order on the key set with the default `Equivalence.DEFAULT` comparison strategy for keys and initializes with a specified capacity. Cite: `org/graalvm/collections/EconomicMap.html#create(int)` ### create(Equivalence) `static EconomicMap create(Equivalence strategy)`. Since 19.0. Creates a new map that guarantees insertion order on the key set with the given comparison strategy for keys. Cite: `org/graalvm/collections/EconomicMap.html#create(org.graalvm.collections.Equivalence)` ### create(UnmodifiableEconomicMap) `static EconomicMap create(UnmodifiableEconomicMap m)`. Since 19.0. Creates a new map that guarantees insertion order on the key set with the default `Equivalence.DEFAULT` comparison strategy for keys and copies all elements from the specified existing map. Cite: `org/graalvm/collections/EconomicMap.html#create(org.graalvm.collections.UnmodifiableEconomicMap)` ### create(Equivalence, UnmodifiableEconomicMap) `static EconomicMap create(Equivalence strategy, UnmodifiableEconomicMap m)`. Since 19.0. Creates a new map that guarantees insertion order on the key set and copies all elements from the specified existing map. Cite: `org/graalvm/collections/EconomicMap.html#create(org.graalvm.collections.Equivalence,org.graalvm.collections.UnmodifiableEconomicMap)` ### create(Equivalence, int) `static EconomicMap create(Equivalence strategy, int initialCapacity)`. Since 19.0. Creates a new map that guarantees insertion order on the key set and initializes with a specified capacity. Cite: `org/graalvm/collections/EconomicMap.html#create(org.graalvm.collections.Equivalence,int)` ### wrapMap(Map) `static EconomicMap wrapMap(Map map)`. Since 19.0. Wraps an existing [`Map`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Map.html) as an `EconomicMap`. Cite: `org/graalvm/collections/EconomicMap.html#wrapMap(java.util.Map)` ### emptyCursor() `static MapCursor emptyCursor()`. Since 22.0. Return an empty `MapCursor`. Cite: `org/graalvm/collections/EconomicMap.html#emptyCursor()` ### emptyMap() `static EconomicMap emptyMap()`. Since 22.2. Return an empty, unmodifiable `EconomicMap`. Cite: `org/graalvm/collections/EconomicMap.html#emptyMap()` ### of(K, V) `static EconomicMap of(K key1, V value1)`. Since 23.0. Creates an `EconomicMap` with one mapping. Parameters: `key1` `K`: the key of the first mapping. `value1` `V`: the value of the first mapping. Returns `EconomicMap`: a map with the mapping. Cite: `org/graalvm/collections/EconomicMap.html#of(K,V)` ### of(K, V, …) `static EconomicMap of(K key1, V value1, K key2, V value2)`. Since 23.0. Creates an `EconomicMap` with two mappings. Parameters: `key1` `K`: the key of the first mapping. `value1` `V`: the value of the first mapping. `key2` `K`: the key of the second mapping. `value2` `V`: the value of the second mapping. Returns `EconomicMap`: a map with two mappings. Cite: `org/graalvm/collections/EconomicMap.html#of(K,V,K,V)` ### computeIfAbsent(K, Function) `default V computeIfAbsent(K key, Function mappingFunction)`. Since 25.1. If the specified key is not already associated with a value (or is mapped to `null`), attempts to compute its value using the given mapping function and enters it into this map unless `null`. A `null` result does not add or replace a mapping. The mapping function must not modify this map, or affect key hash code or equivalence during computation. Implementations are not required to detect such changes. Parameters: `key` `K`: non-null key with which the specified value is to be associated. `mappingFunction` `Function`: the mapping function to compute a value. Returns `V`: the current (existing or computed) value associated with the specified key, or null if the computed value is null. Cite: `org/graalvm/collections/EconomicMap.html#computeIfAbsent(K,java.util.function.Function)` ## Inherited members - From interface [`UnmodifiableEconomicMap`](org/graalvm/collections/UnmodifiableEconomicMap.md): [`containsKey`](org/graalvm/collections/UnmodifiableEconomicMap.md#containsKey%28K%29), [`get`](org/graalvm/collections/UnmodifiableEconomicMap.md#get%28K%29), [`get`](org/graalvm/collections/UnmodifiableEconomicMap.md#get%28K,V%29), [`getEquivalenceStrategy`](org/graalvm/collections/UnmodifiableEconomicMap.md#getEquivalenceStrategy%28%29), [`getKeys`](org/graalvm/collections/UnmodifiableEconomicMap.md#getKeys%28%29), [`getValues`](org/graalvm/collections/UnmodifiableEconomicMap.md#getValues%28%29), [`isEmpty`](org/graalvm/collections/UnmodifiableEconomicMap.md#isEmpty%28%29), [`size`](org/graalvm/collections/UnmodifiableEconomicMap.md#size%28%29) # ◆ EconomicMapUtil [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 23.0. ```java public final class EconomicMapUtil ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `EconomicMapUtil` Utility methods for the [`EconomicMap`](org/graalvm/collections/EconomicMap.md). ## Methods ### equals(UnmodifiableEconomicMap, UnmodifiableEconomicMap) `public static boolean equals(UnmodifiableEconomicMap lhs, UnmodifiableEconomicMap rhs)`. Since 23.0. Compares maps for equality. The maps are equal iff they share the same `equivalence strategy`, their keys are equal with respect to the strategy and the values are equal as determined by the [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Objects.html#equals%28java.lang.Object,java.lang.Object%29) method. Parameters: `lhs` `UnmodifiableEconomicMap`: the first map to be compared. `rhs` `UnmodifiableEconomicMap`: the second map to be compared. Returns `boolean`: `true` iff the maps are equal. Cite: `org/graalvm/collections/EconomicMapUtil.html#equals(org.graalvm.collections.UnmodifiableEconomicMap,org.graalvm.collections.UnmodifiableEconomicMap)` ### hashCode(UnmodifiableEconomicMap) `public static int hashCode(UnmodifiableEconomicMap map)`. Since 23.0. Computes an order-independent hash code for an `EconomicMap`. Parameters: `map` `UnmodifiableEconomicMap`: the input map or `null`. Returns `int`: the hash code of the map. Cite: `org/graalvm/collections/EconomicMapUtil.html#hashCode(org.graalvm.collections.UnmodifiableEconomicMap)` ### keySet(EconomicMap) `public static EconomicSet keySet(EconomicMap map)`. Since 23.0. Returns an `EconomicSet` of the keys contained in a map. Parameters: `map` `EconomicMap`: the input map. Returns `EconomicSet`: an `EconomicSet` of the keys contained in a map. Cite: `org/graalvm/collections/EconomicMapUtil.html#keySet(org.graalvm.collections.EconomicMap)` ### lexicographicalComparator(Comparator, Comparator) `public static Comparator> lexicographicalComparator(Comparator keyComparator, Comparator valueComparator)`. Since 23.0. Creates a lexicographical map comparator using the provided key and value comparators. The maps are treated as if they were lists with the structure `{key1, value1, key2, value2, ...}`. The comparison starts by comparing their `key1` and if they are equal, it goes on to compare `value1`, then `key2`, `value2` and so on. If one of the maps is shorter, the comparators are called with `null` values in place of the missing keys/values. Parameters: `keyComparator` `Comparator`: a comparator to compare keys. `valueComparator` `Comparator`: a comparator to compare values. Returns `Comparator>`: a lexicographical map comparator. Cite: `org/graalvm/collections/EconomicMapUtil.html#lexicographicalComparator(java.util.Comparator,java.util.Comparator)` ## Inherited members - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`toString`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) # ◆ EconomicMapWrap [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 21.1. ```java public class EconomicMapWrap implements EconomicMap ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `EconomicMapWrap` Implements: [`EconomicMap`](org/graalvm/collections/EconomicMap.md)`` Wraps an existing [`Map`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Map.html) as an [`EconomicMap`](org/graalvm/collections/EconomicMap.md). ## Constructors ### EconomicMapWrap(Map) `public EconomicMapWrap(Map map)`. Since 21.1. Cite: `org/graalvm/collections/EconomicMapWrap.html#(java.util.Map)` ## Methods ### get(K) `public V get(K key)`. Since 21.1. Returns the value to which `key` is mapped, or `null` if this map contains no mapping for `key`. The `key` must not be `null`. Overrides `get()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#get(K)` ### get(K, V) `public V get(K key, V defaultValue)`. Returns the value to which `key` is mapped, or `defaultValue` if this map contains no mapping for `key`. The `key` must not be `null`. Maps that support {code null} values, need to overwrite this method to appropriately handle the {code null} case. Description copied from `get()`. Throws: `UnsupportedOperationException` (unchecked): if `key == null`. Overrides `get()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#get(K,V)` ### put(K, V) `public V put(K key, V value)`. Since 21.1. Associates `value` with `key` in this map. If the map previously contained a mapping for `key`, the old value is replaced by `value`. While the `value` may be `null`, the `key` must not be {code null}. Returns `V`: the previous value associated with `key`, or `null` if there was no mapping for `key`. Overrides `put()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#put(K,V)` ### putIfAbsent(K, V) `public V putIfAbsent(K key, V value)`. Since 21.1. If the specified key is not already associated with a value (or is mapped to `null`) associates it with the given value and returns `null`, else returns the current value. Parameters: `key` `K`: non-null key with which the specified value is to be associated. `value` `V`: value to be associated with the specified key. Returns `V`: the previous value associated with the specified key, or `null` if there was no mapping for the key. (A `null` return can also indicate that the map previously associated `null` with the key, if the implementation supports null values.). Overrides `putIfAbsent()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#putIfAbsent(K,V)` ### size() `public int size()`. Since 21.1. Returns the number of key-value mappings in this map. Overrides `size()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#size()` ### containsKey(K) `public boolean containsKey(K key)`. Since 21.1. Returns `true` if this map contains a mapping for `key`. The `key` must not be `null`. Overrides `containsKey()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#containsKey(K)` ### clear() `public void clear()`. Since 21.1. Removes all the mappings from this map. The map will be empty after this call returns. Overrides `clear()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#clear()` ### removeKey(K) `public V removeKey(K key)`. Since 21.1. Removes the mapping for `key` from this map if it is present. The map will not contain a mapping for `key` once the call returns. The `key` must not be `null`. Returns `V`: the previous value associated with `key`, or `null` if there was no mapping for `key`. Overrides `removeKey()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#removeKey(K)` ### getValues() `public Iterable getValues()`. Since 21.1. Returns a [`Iterable`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html) view of the values contained in this map. Overrides `getValues()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#getValues()` ### getKeys() `public Iterable getKeys()`. Since 21.1. Returns a [`Iterable`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html) view of the keys contained in this map. Overrides `getKeys()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#getKeys()` ### isEmpty() `public boolean isEmpty()`. Since 21.1. Returns `true` if this map contains no key-value mappings. Overrides `isEmpty()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#isEmpty()` ### getEntries() `public MapCursor getEntries()`. Since 21.1. Returns a `MapCursor` view of the mappings contained in this map. Overrides `getEntries()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#getEntries()` ### replaceAll(BiFunction) `public void replaceAll(BiFunction function)`. Since 21.1. Replaces each entry's value with the result of invoking `function` on that entry until all entries have been processed or the function throws an exception. Exceptions thrown by the function are relayed to the caller. Overrides `replaceAll()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#replaceAll(java.util.function.BiFunction)` ### computeIfAbsent(K, Function) `public V computeIfAbsent(K key, Function mappingFunction)`. Since 25.1. If the specified key is not already associated with a value (or is mapped to `null`), attempts to compute its value using the given mapping function and enters it into this map unless `null`. A `null` result does not add or replace a mapping. The mapping function must not modify this map, or affect key hash code or equivalence during computation. Implementations are not required to detect such changes. Parameters: `key` `K`: non-null key with which the specified value is to be associated. `mappingFunction` `Function`: the mapping function to compute a value. Returns `V`: the current (existing or computed) value associated with the specified key, or null if the computed value is null. Overrides `computeIfAbsent()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#computeIfAbsent(K,java.util.function.Function)` ### toString() `public String toString()`. Since 23.1. Overrides `toString()`. Cite: `org/graalvm/collections/EconomicMapWrap.html#toString()` ## Inherited members - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) - From interface [`EconomicMap`](org/graalvm/collections/EconomicMap.md): [`putAll`](org/graalvm/collections/EconomicMap.md#putAll%28org.graalvm.collections.EconomicMap%29), [`putAll`](org/graalvm/collections/EconomicMap.md#putAll%28org.graalvm.collections.UnmodifiableEconomicMap%29), [`trimToSize`](org/graalvm/collections/EconomicMap.md#trimToSize%28%29) - From interface [`UnmodifiableEconomicMap`](org/graalvm/collections/UnmodifiableEconomicMap.md): [`getEquivalenceStrategy`](org/graalvm/collections/UnmodifiableEconomicMap.md#getEquivalenceStrategy%28%29) # ◇ EconomicSet [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Interface in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 19.0. ```java public interface EconomicSet extends UnmodifiableEconomicSet ``` Extends: [`UnmodifiableEconomicSet`](org/graalvm/collections/UnmodifiableEconomicSet.md)`` Memory efficient set data structure. It does not support adding, looking up or removing a `null` element. ## Methods ### add(E) `boolean add(E element)`. Since 19.0. Adds non-null `element` to this set if it is not already present. Returns `boolean`: `true` if this set did not already contain `element`. Throws: `UnsupportedOperationException` (unchecked): if `element == null`. Cite: `org/graalvm/collections/EconomicSet.html#add(E)` ### remove(E) `void remove(E element)`. Since 19.0. Removes non-null `element` from this set if it is present. This set will not contain `element` once the call returns. Throws: `UnsupportedOperationException` (unchecked): if `element == null`. Cite: `org/graalvm/collections/EconomicSet.html#remove(E)` ### clear() `void clear()`. Since 19.0. Removes all the elements from this set. The set will be empty after this call returns. Cite: `org/graalvm/collections/EconomicSet.html#clear()` ### addAll(EconomicSet) `default void addAll(EconomicSet other)`. Since 19.0. Adds all the elements in `other` to this set if they're not already present. Cite: `org/graalvm/collections/EconomicSet.html#addAll(org.graalvm.collections.EconomicSet)` ### addAll(Iterable) `default void addAll(Iterable values)`. Since 19.0. Adds all the elements in `values` to this set if they're not already present. Cite: `org/graalvm/collections/EconomicSet.html#addAll(java.lang.Iterable)` ### addAll(Iterator) `default void addAll(Iterator iterator)`. Since 19.0. Adds all the elements enumerated by `iterator` to this set if they're not already present. Cite: `org/graalvm/collections/EconomicSet.html#addAll(java.util.Iterator)` ### removeAll(EconomicSet) `default void removeAll(EconomicSet other)`. Since 19.0. Removes from this set all of its elements that are contained in `other`. Cite: `org/graalvm/collections/EconomicSet.html#removeAll(org.graalvm.collections.EconomicSet)` ### removeAll(Iterable) `default void removeAll(Iterable values)`. Since 19.0. Removes from this set all of its elements that are contained in `values`. Cite: `org/graalvm/collections/EconomicSet.html#removeAll(java.lang.Iterable)` ### removeAll(Iterator) `default void removeAll(Iterator iterator)`. Since 19.0. Removes from this set all of its elements that are enumerated by `iterator`. Cite: `org/graalvm/collections/EconomicSet.html#removeAll(java.util.Iterator)` ### retainAll(EconomicSet) `default void retainAll(EconomicSet other)`. Since 19.0. Removes from this set all of its elements that are not contained in `other`. Cite: `org/graalvm/collections/EconomicSet.html#retainAll(org.graalvm.collections.EconomicSet)` ### create() `static EconomicSet create()`. Since 19.0. Creates a new set guaranteeing insertion order when iterating over its elements with the default `Equivalence.DEFAULT` comparison strategy. Cite: `org/graalvm/collections/EconomicSet.html#create()` ### create(Equivalence) `static EconomicSet create(Equivalence strategy)`. Since 19.0. Creates a new set guaranteeing insertion order when iterating over its elements. Cite: `org/graalvm/collections/EconomicSet.html#create(org.graalvm.collections.Equivalence)` ### create(int) `static EconomicSet create(int initialCapacity)`. Since 19.0. Creates a new set guaranteeing insertion order when iterating over its elements with the default `Equivalence.DEFAULT` comparison strategy. Cite: `org/graalvm/collections/EconomicSet.html#create(int)` ### create(UnmodifiableEconomicSet) `static EconomicSet create(UnmodifiableEconomicSet c)`. Since 19.0. Creates a new set guaranteeing insertion order when iterating over its elements with the default `Equivalence.DEFAULT` comparison strategy and inserts all elements of the specified collection. Cite: `org/graalvm/collections/EconomicSet.html#create(org.graalvm.collections.UnmodifiableEconomicSet)` ### create(Equivalence, int) `static EconomicSet create(Equivalence strategy, int initialCapacity)`. Since 19.0. Creates a new set guaranteeing insertion order when iterating over its elements and initializes with the given capacity. Cite: `org/graalvm/collections/EconomicSet.html#create(org.graalvm.collections.Equivalence,int)` ### create(Equivalence, UnmodifiableEconomicSet) `static EconomicSet create(Equivalence strategy, UnmodifiableEconomicSet c)`. Since 19.0. Creates a new set guaranteeing insertion order when iterating over its elements and inserts all elements of the specified collection. Cite: `org/graalvm/collections/EconomicSet.html#create(org.graalvm.collections.Equivalence,org.graalvm.collections.UnmodifiableEconomicSet)` ### create(Iterable) `static EconomicSet create(Iterable c)`. Since 25.1. Creates a new set guaranteeing insertion order when iterating over its elements with the default `Equivalence.DEFAULT` comparison strategy and inserts all elements of the specified iterable. Cite: `org/graalvm/collections/EconomicSet.html#create(java.lang.Iterable)` ### emptySet() `static EconomicSet emptySet()`. Since 25.0. Return an empty, unmodifiable `EconomicSet`. Cite: `org/graalvm/collections/EconomicSet.html#emptySet()` ### of(E) `static EconomicSet of(E elem)`. Cite: `org/graalvm/collections/EconomicSet.html#of(E)` ## Inherited members - From interface [`UnmodifiableEconomicSet`](org/graalvm/collections/UnmodifiableEconomicSet.md): [`contains`](org/graalvm/collections/UnmodifiableEconomicSet.md#contains%28E%29), [`containsAll`](org/graalvm/collections/UnmodifiableEconomicSet.md#containsAll%28java.lang.Iterable%29), [`isEmpty`](org/graalvm/collections/UnmodifiableEconomicSet.md#isEmpty%28%29), [`removeIf`](org/graalvm/collections/UnmodifiableEconomicSet.md#removeIf%28java.util.function.Predicate%29), [`size`](org/graalvm/collections/UnmodifiableEconomicSet.md#size%28%29), [`toArray`](org/graalvm/collections/UnmodifiableEconomicSet.md#toArray%28E[]%29), [`toHashSet`](org/graalvm/collections/UnmodifiableEconomicSet.md#toHashSet%28%29), [`toList`](org/graalvm/collections/UnmodifiableEconomicSet.md#toList%28%29) - From interface [`Iterable`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html): [`forEach`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html#forEach%28java.util.function.Consumer%29), [`iterator`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html#iterator%28%29), [`spliterator`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html#spliterator%28%29) # ◆ Equivalence [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Abstract class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 19.0. ```java public abstract class Equivalence ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `Equivalence` Strategy for comparing two objects. Default predefined strategies are [`DEFAULT`](org/graalvm/collections/Equivalence.md#DEFAULT), [`IDENTITY`](org/graalvm/collections/Equivalence.md#IDENTITY), and [`IDENTITY_WITH_SYSTEM_HASHCODE`](org/graalvm/collections/Equivalence.md#IDENTITY_WITH_SYSTEM_HASHCODE). ## Fields ### DEFAULT `public static final Equivalence DEFAULT`. Since 19.0. Default equivalence calling [`equals(Object)`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29) to check equality and [`hashCode()`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29) for obtaining hash values. Do not change the logic of this class as it may be inlined in other places. Cite: `org/graalvm/collections/Equivalence.html#DEFAULT` ### IDENTITY `public static final Equivalence IDENTITY`. Since 19.0. Identity equivalence using `==` to check equality and [`hashCode()`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29) for obtaining hash values. Do not change the logic of this class as it may be inlined in other places. Cite: `org/graalvm/collections/Equivalence.html#IDENTITY` ### IDENTITY_WITH_SYSTEM_HASHCODE `public static final Equivalence IDENTITY_WITH_SYSTEM_HASHCODE`. Since 19.0. Identity equivalence using `==` to check equality and [`System.identityHashCode(Object)`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/System.html#identityHashCode%28java.lang.Object%29) for obtaining hash values. Do not change the logic of this class as it may be inlined in other places. Cite: `org/graalvm/collections/Equivalence.html#IDENTITY_WITH_SYSTEM_HASHCODE` ## Constructors ### Equivalence() `protected Equivalence()`. Since 19.0. Subclass for creating custom equivalence definitions. Cite: `org/graalvm/collections/Equivalence.html#()` ## Methods ### equals(Object, Object) `public abstract boolean equals(Object a, Object b)`. Since 19.0. Returns `true` if the non-`null` arguments are equal to each other and `false` otherwise. Cite: `org/graalvm/collections/Equivalence.html#equals(java.lang.Object,java.lang.Object)` ### hashCode(Object) `public abstract int hashCode(Object o)`. Since 19.0. Returns the hash code of a non-`null` argument `o`. Cite: `org/graalvm/collections/Equivalence.html#hashCode(java.lang.Object)` ## Inherited members - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`toString`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) # ◆ LockFreePool [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 23.0. ```java public class LockFreePool ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `LockFreePool` Concurrent lock-free pool data structure. Supports two operations -- adding an element, and removing an element. The [`LockFreePool.add(Object)`](org/graalvm/collections/LockFreePool.md#add%28T%29) operation adds an element into the pool. The [`LockFreePool.get()`](org/graalvm/collections/LockFreePool.md#get%28%29) operation returns one of the elements previously added to the pool. There is no guarantee about the order in which the elements are returned by [`LockFreePool.get()`](org/graalvm/collections/LockFreePool.md#get%28%29). The guarantee is that an element will only be returned by [`LockFreePool.get()`](org/graalvm/collections/LockFreePool.md#get%28%29) as many times as it was previously added to the pool by calling [`LockFreePool.add(Object)`](org/graalvm/collections/LockFreePool.md#add%28T%29). If there are no more elements to return, it will return `null`. Both operations are lock-free and linearizable -- this data structure is intended for use by multiple threads. The internal implementation is a simple Treiber stack. **Type parameters** - ``: Type of the elements in this pool. ## Constructors ### LockFreePool() `public LockFreePool()`. Since 23.0. Cite: `org/graalvm/collections/LockFreePool.html#()` ## Methods ### get() `public T get()`. Since 23.0. Returns a previously added element. This method returns a previously added element only once to some caller. If the element was added multiple times, calling this method will return that element as many times before returning `null`. This method does not do any object allocations. Returns `T`: A previously added element, or `null` if there are no previously added elements that have not been already returned. Cite: `org/graalvm/collections/LockFreePool.html#get()` ### add(T) `public void add(T element)`. Since 23.0. Adds an element to this pool. An element can be added multiple times to the pool, but in this case may be returned as many times by `LockFreePool.get()`. This method internally allocates objects on the heap. Parameters: `element` `T`: An element to add to the pool. Cite: `org/graalvm/collections/LockFreePool.html#add(T)` ## Inherited members - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`toString`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) # ◆ LockFreePrefixTree [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 22.3. ```java public class LockFreePrefixTree ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `LockFreePrefixTree` Thread-safe and lock-free prefix-tree implementation in which keys are sequences of 64-bit values, and the values are 64-bit values. The LockFreePrefixTree supports the same operations as the PrefixTree as follows: The LockFreePrefixTree supports a single operation `root`, which returns the root node. The nodes support the following operations: `at` to obtain a child node, `value` to obtain the value at the current node, `setValue` to atomically set the value, and `incValue` to atomically increment the value. The LockFreePrefix tree represents a Tree of nodes of class`Node`, with each node having a key and an atomic reference array of children. The underlying `children` structure is represented as a LinearArray if the number of children is under a threshold, and represented by a hash table once the threshold is reached. Any additions or accesses to the datastructure are done using the `at` function. The `at` function takes a key value as a parameter and either returns an already existing node or inserts a new node and returns it. The function may cause the underlying AtomicReferenceArray to grow in size, either with `tryResizeLinear` or `tryResizeHash`. Insertion of new nodes is always done with the CAS operation, to ensure atomic updates and guarantee the progress of at least a single thread in the execution. Additionally, any growth operations occur atomically, as we perform a CAS with the reference to the Array to a new, freshly allocated array object. ## Nested types - [`LockFreePrefixTree.Allocator`](org/graalvm/collections/LockFreePrefixTree.Allocator.md) (abstract class): Policy for allocating objects of the lock-free prefix tree. - [`LockFreePrefixTree.HeapAllocator`](org/graalvm/collections/LockFreePrefixTree.HeapAllocator.md) (class): Allocator that allocates objects directly on the managed heap. - [`LockFreePrefixTree.Node`](org/graalvm/collections/LockFreePrefixTree.Node.md) (class): No description. - [`LockFreePrefixTree.ObjectPoolingAllocator`](org/graalvm/collections/LockFreePrefixTree.ObjectPoolingAllocator.md) (class): Allocator that internally maintains several pools of preallocated objects, and allocates objects from those pools. ## Constructors ### LockFreePrefixTree(LockFreePrefixTree.Allocator) `public LockFreePrefixTree(LockFreePrefixTree.Allocator allocator)`. Since 22.3. Create new `LockFreePrefixTree` with root being a Node with key 0. Cite: `org/graalvm/collections/LockFreePrefixTree.html#(org.graalvm.collections.LockFreePrefixTree.Allocator)` ## Methods ### allocator() `public LockFreePrefixTree.Allocator allocator()`. Cite: `org/graalvm/collections/LockFreePrefixTree.html#allocator()` ### root() `public LockFreePrefixTree.Node root()`. Since 22.3. The root node of the tree. Returns `LockFreePrefixTree.Node`: the root of the tree. Cite: `org/graalvm/collections/LockFreePrefixTree.html#root()` ### reset() `public void reset()`. Since 23.0. Resets the tree. Cite: `org/graalvm/collections/LockFreePrefixTree.html#reset()` ### topDown(C, BiFunction, BiConsumer) `public void topDown(C initialContext, BiFunction createContext, BiConsumer consumeValue)`. Since 22.3. Traverse the tree top-down while maintaining a context. The context is a generic data structure corresponding to the depth of the traversal, i.e. given the initialContext and a createContext function, a new context is created for each visited child using the createContext function, starting with initialContext. Type parameters: ``: The type of the context. Parameters: `initialContext` `C`: The context for the root of the tree. `createContext` `BiFunction`: A function defining how the context for children is created. `consumeValue` `BiConsumer`: A function that consumes the nodes value. Cite: `org/graalvm/collections/LockFreePrefixTree.html#topDown(C,java.util.function.BiFunction,java.util.function.BiConsumer)` ## Inherited members - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`toString`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) # ◆ LockFreePrefixTree.Allocator [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Abstract class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 23.0. Nested in [`LockFreePrefixTree`](org/graalvm/collections/LockFreePrefixTree.md). ```java public abstract static class LockFreePrefixTree.Allocator ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `Allocator` Policy for allocating objects of the lock-free prefix tree. ## Constructors ### Allocator() `public Allocator()`. Declared by the compiler. Creates a new Allocator instance. Cite: `org/graalvm/collections/LockFreePrefixTree.Allocator.html#()` ## Methods ### newNode(long) `public abstract LockFreePrefixTree.Node newNode(long key)`. Since 23.0. Allocates a new Node object. Parameters: `key` `long`: The key to use for the `Node` object. Returns `LockFreePrefixTree.Node`: A fresh `Node` object, possibly preallocated. Throws: `LockFreePrefixTree.FailedAllocationException` (unchecked): If the allocation request cannot be fulfilled. Cite: `org/graalvm/collections/LockFreePrefixTree.Allocator.html#newNode(long)` ### newLinearChildren(int) `public abstract LockFreePrefixTree.Node.LinearChildren newLinearChildren(int length)`. Since 23.0. Allocates a new reference array of child nodes stored linearly. Parameters: `length` `int`: The length of the allocated array. Returns `LockFreePrefixTree.Node.LinearChildren`: A fresh array, possibly preallocated. Throws: `LockFreePrefixTree.FailedAllocationException` (unchecked): If the allocation request cannot be fulfilled. Cite: `org/graalvm/collections/LockFreePrefixTree.Allocator.html#newLinearChildren(int)` ### newHashChildren(int) `public abstract LockFreePrefixTree.Node.HashChildren newHashChildren(int length)`. Since 23.0. Allocates a new reference array of child nodes stored as a hash table. Parameters: `length` `int`: The length of the allocated array. Returns `LockFreePrefixTree.Node.HashChildren`: A fresh array, possibly preallocated. Throws: `LockFreePrefixTree.FailedAllocationException` (unchecked): If the allocation request cannot be fulfilled. Cite: `org/graalvm/collections/LockFreePrefixTree.Allocator.html#newHashChildren(int)` ### shutdown() `public abstract void shutdown()`. Since 23.0. Releases the allocator's resources. Allocator should not be used after calling this method. Cite: `org/graalvm/collections/LockFreePrefixTree.Allocator.html#shutdown()` ## Inherited members - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`toString`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) # ◆ LockFreePrefixTree.HeapAllocator [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 23.0. Nested in [`LockFreePrefixTree`](org/graalvm/collections/LockFreePrefixTree.md). ```java public static class LockFreePrefixTree.HeapAllocator extends LockFreePrefixTree.Allocator ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > [`LockFreePrefixTree.Allocator`](org/graalvm/collections/LockFreePrefixTree.Allocator.md) > `HeapAllocator` Allocator that allocates objects directly on the managed heap. ## Constructors ### HeapAllocator() `public HeapAllocator()`. Declared by the compiler. Creates a new HeapAllocator instance. Cite: `org/graalvm/collections/LockFreePrefixTree.HeapAllocator.html#()` ## Methods ### newNode(long) `public LockFreePrefixTree.Node newNode(long key)`. Since 23.0. Allocates a new Node object. Parameters: `key` `long`: The key to use for the `Node` object. Returns `LockFreePrefixTree.Node`: A fresh `Node` object, possibly preallocated. Overrides `newNode()`. Cite: `org/graalvm/collections/LockFreePrefixTree.HeapAllocator.html#newNode(long)` ### newLinearChildren(int) `public LockFreePrefixTree.Node.LinearChildren newLinearChildren(int length)`. Since 23.0. Allocates a new reference array of child nodes stored linearly. Parameters: `length` `int`: The length of the allocated array. Returns `LockFreePrefixTree.Node.LinearChildren`: A fresh array, possibly preallocated. Overrides `newLinearChildren()`. Cite: `org/graalvm/collections/LockFreePrefixTree.HeapAllocator.html#newLinearChildren(int)` ### newHashChildren(int) `public LockFreePrefixTree.Node.HashChildren newHashChildren(int length)`. Since 23.0. Allocates a new reference array of child nodes stored as a hash table. Parameters: `length` `int`: The length of the allocated array. Returns `LockFreePrefixTree.Node.HashChildren`: A fresh array, possibly preallocated. Overrides `newHashChildren()`. Cite: `org/graalvm/collections/LockFreePrefixTree.HeapAllocator.html#newHashChildren(int)` ### shutdown() `public void shutdown()`. Since 23.0. Releases the allocator's resources. Allocator should not be used after calling this method. Overrides `shutdown()`. Cite: `org/graalvm/collections/LockFreePrefixTree.HeapAllocator.html#shutdown()` ## Inherited members - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`toString`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) # ◆ LockFreePrefixTree.Node [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 22.3. Nested in [`LockFreePrefixTree`](org/graalvm/collections/LockFreePrefixTree.md). ```java public static class LockFreePrefixTree.Node extends AtomicLong ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > [`Number`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Number.html) > [`AtomicLong`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html) > `Node` ## Methods ### value() `public long value()`. Since 22.3. Returns `long`: The value of the `Node`. Cite: `org/graalvm/collections/LockFreePrefixTree.Node.html#value()` ### setValue(long) `public void setValue(long value)`. Since 22.3. Set the value for the `Node`. Parameters: `value` `long`: the new value. Cite: `org/graalvm/collections/LockFreePrefixTree.Node.html#setValue(long)` ### incValue() `public long incValue()`. Since 22.3. Increment value. Returns `long`: newly incremented value of the `Node`. Cite: `org/graalvm/collections/LockFreePrefixTree.Node.html#incValue()` ### bitwiseOrValue(long) `public long bitwiseOrValue(long pattern)`. Since 23.0. Atomically does the bitwise-or on the current value. Parameters: `pattern` `long`: a bit pattern to do bitwise-or with. Returns `long`: the value immediately after the bitwise-or operation. Cite: `org/graalvm/collections/LockFreePrefixTree.Node.html#bitwiseOrValue(long)` ### at(LockFreePrefixTree.Allocator, long) `public LockFreePrefixTree.Node at(LockFreePrefixTree.Allocator allocator, long childKey)`. Since 22.3. Get existing (or create if missing) child with the given key. May return `null` if the operation cannot complete, for example, due to inability to allocate nodes. Parameters: `childKey` `long`: the key of the child. Returns `LockFreePrefixTree.Node`: The child with the given childKey, or `null` if cannot complete. Cite: `org/graalvm/collections/LockFreePrefixTree.Node.html#at(org.graalvm.collections.LockFreePrefixTree.Allocator,long)` ### toString() `public String toString()`. Since 22.3. Overrides `toString()`. Cite: `org/graalvm/collections/LockFreePrefixTree.Node.html#toString()` ## Inherited members - From class [`AtomicLong`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html): [`accumulateAndGet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#accumulateAndGet%28long,java.util.function.LongBinaryOperator%29), [`addAndGet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#addAndGet%28long%29), [`compareAndExchange`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#compareAndExchange%28long,long%29), [`compareAndExchangeAcquire`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#compareAndExchangeAcquire%28long,long%29), [`compareAndExchangeRelease`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#compareAndExchangeRelease%28long,long%29), [`compareAndSet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#compareAndSet%28long,long%29), [`decrementAndGet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#decrementAndGet%28%29), [`doubleValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#doubleValue%28%29), [`floatValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#floatValue%28%29), [`get`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#get%28%29), [`getAcquire`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAcquire%28%29), [`getAndAccumulate`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndAccumulate%28long,java.util.function.LongBinaryOperator%29), [`getAndAdd`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndAdd%28long%29), [`getAndDecrement`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndDecrement%28%29), [`getAndIncrement`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndIncrement%28%29), [`getAndSet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndSet%28long%29), [`getAndUpdate`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndUpdate%28java.util.function.LongUnaryOperator%29), [`getOpaque`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getOpaque%28%29), [`getPlain`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getPlain%28%29), [`incrementAndGet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#incrementAndGet%28%29), [`intValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#intValue%28%29), [`lazySet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#lazySet%28long%29), [`longValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#longValue%28%29), [`set`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#set%28long%29), [`setOpaque`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#setOpaque%28long%29), [`setPlain`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#setPlain%28long%29), [`setRelease`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#setRelease%28long%29), [`updateAndGet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#updateAndGet%28java.util.function.LongUnaryOperator%29), [`weakCompareAndSet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#weakCompareAndSet%28long,long%29), [`weakCompareAndSetAcquire`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#weakCompareAndSetAcquire%28long,long%29), [`weakCompareAndSetPlain`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#weakCompareAndSetPlain%28long,long%29), [`weakCompareAndSetRelease`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#weakCompareAndSetRelease%28long,long%29), [`weakCompareAndSetVolatile`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#weakCompareAndSetVolatile%28long,long%29) - From class [`Number`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Number.html): [`byteValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Number.html#byteValue%28%29), [`shortValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Number.html#shortValue%28%29) - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) # ◆ LockFreePrefixTree.ObjectPoolingAllocator [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 23.0. Nested in [`LockFreePrefixTree`](org/graalvm/collections/LockFreePrefixTree.md). ```java public static class LockFreePrefixTree.ObjectPoolingAllocator extends LockFreePrefixTree.Allocator ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > [`LockFreePrefixTree.Allocator`](org/graalvm/collections/LockFreePrefixTree.Allocator.md) > `ObjectPoolingAllocator` Allocator that internally maintains several pools of preallocated objects, and allocates objects from those pools. This allocator is guaranteed not to allocate any objects inside the invocations to its methods. To ensure that the internal pools have sufficiently many preallocated objects, this allocator has a housekeeping thread that periodically wakes up, allocates objects and inserts them into the pools. This allocator tracks the requests that failed since the last housekeeping session, and the housekeeping thread will strive to accomodate requests that have not been fulfilled since the last housekeeping session (i.e. it will preallocate those types of additional objects whose allocation request previously failed, and it will allocate at least as many objects as there were previous failed allocation requests). This implementation only allows allocating `Node.LinearChildren` and `Node.HashChildren` arrays whose length is a power of 2 (because [`LockFreePrefixTree`](org/graalvm/collections/LockFreePrefixTree.md) only ever allocates arrays that are a power of 2). If the requested array length is not a power of 2, an exception is thrown. ## Constructors ### ObjectPoolingAllocator() `public ObjectPoolingAllocator()`. Since 23.0. Cite: `org/graalvm/collections/LockFreePrefixTree.ObjectPoolingAllocator.html#()` ### ObjectPoolingAllocator(int) `public ObjectPoolingAllocator(int housekeepingPeriodMillis)`. Since 23.0. Cite: `org/graalvm/collections/LockFreePrefixTree.ObjectPoolingAllocator.html#(int)` ## Methods ### newNode(long) `public LockFreePrefixTree.Node newNode(long key)`. Since 23.0. Allocates a new Node object. Parameters: `key` `long`: The key to use for the `Node` object. Returns `LockFreePrefixTree.Node`: A fresh `Node` object, possibly preallocated. Overrides `newNode()`. Cite: `org/graalvm/collections/LockFreePrefixTree.ObjectPoolingAllocator.html#newNode(long)` ### newLinearChildren(int) `public LockFreePrefixTree.Node.LinearChildren newLinearChildren(int length)`. Since 23.0. Allocates a new reference array of child nodes stored linearly. Parameters: `length` `int`: The length of the allocated array. Returns `LockFreePrefixTree.Node.LinearChildren`: A fresh array, possibly preallocated. Overrides `newLinearChildren()`. Cite: `org/graalvm/collections/LockFreePrefixTree.ObjectPoolingAllocator.html#newLinearChildren(int)` ### newHashChildren(int) `public LockFreePrefixTree.Node.HashChildren newHashChildren(int length)`. Since 23.0. Allocates a new reference array of child nodes stored as a hash table. Parameters: `length` `int`: The length of the allocated array. Returns `LockFreePrefixTree.Node.HashChildren`: A fresh array, possibly preallocated. Overrides `newHashChildren()`. Cite: `org/graalvm/collections/LockFreePrefixTree.ObjectPoolingAllocator.html#newHashChildren(int)` ### shutdown() `public void shutdown()`. Since 23.0. Releases the allocator's resources. Allocator should not be used after calling this method. Overrides `shutdown()`. Cite: `org/graalvm/collections/LockFreePrefixTree.ObjectPoolingAllocator.html#shutdown()` ### status() `public String status()`. Cite: `org/graalvm/collections/LockFreePrefixTree.ObjectPoolingAllocator.html#status()` ## Inherited members - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`toString`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) # ◇ MapCursor [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Interface in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 19.0. ```java public interface MapCursor extends UnmodifiableMapCursor ``` Extends: [`UnmodifiableMapCursor`](org/graalvm/collections/UnmodifiableMapCursor.md)`` Cursor to iterate over a mutable map. ## Methods ### remove() `void remove()`. Since 19.0. Remove the current entry from the map. May only be called once. After calling `remove()`, it is no longer valid to call `getKey()` or `getValue()` on the current entry. Cite: `org/graalvm/collections/MapCursor.html#remove()` ### setValue(V) `default V setValue(V newValue)`. Since 22.1. Set the value of the current entry. Parameters: `newValue` `V`: new value to be associated with the current key. Returns `V`: previous value associated with the current key. Cite: `org/graalvm/collections/MapCursor.html#setValue(V)` ## Inherited members - From interface [`UnmodifiableMapCursor`](org/graalvm/collections/UnmodifiableMapCursor.md): [`advance`](org/graalvm/collections/UnmodifiableMapCursor.md#advance%28%29), [`getKey`](org/graalvm/collections/UnmodifiableMapCursor.md#getKey%28%29), [`getValue`](org/graalvm/collections/UnmodifiableMapCursor.md#getValue%28%29) # ◆ Pair [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 19.0. ```java public final class Pair ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `Pair` Utility class representing a pair of values. ## Methods ### empty() `public static Pair empty()`. Since 19.0. Returns an empty pair. Cite: `org/graalvm/collections/Pair.html#empty()` ### createLeft(L) `public static Pair createLeft(L left)`. Since 19.0. Constructs a pair with its left value being `left`, or returns an empty pair if `left` is null. Returns `Pair`: the constructed pair or an empty pair if `left` is null. Cite: `org/graalvm/collections/Pair.html#createLeft(L)` ### createRight(R) `public static Pair createRight(R right)`. Since 19.0. Constructs a pair with its right value being `right`, or returns an empty pair if `right` is null. Returns `Pair`: the constructed pair or an empty pair if `right` is null. Cite: `org/graalvm/collections/Pair.html#createRight(R)` ### create(L, R) `public static Pair create(L left, R right)`. Since 19.0. Constructs a pair with its left value being `left`, and its right value being `right`, or returns an empty pair if both inputs are null. Returns `Pair`: the constructed pair or an empty pair if both inputs are null. Cite: `org/graalvm/collections/Pair.html#create(L,R)` ### getLeft() `public L getLeft()`. Since 19.0. Returns the left value of this pair. Cite: `org/graalvm/collections/Pair.html#getLeft()` ### getRight() `public R getRight()`. Since 19.0. Returns the right value of this pair. Cite: `org/graalvm/collections/Pair.html#getRight()` ### hashCode() `public int hashCode()`. Since 19.0. Overrides `hashCode()`. Cite: `org/graalvm/collections/Pair.html#hashCode()` ### equals(Object) `public boolean equals(Object obj)`. Since 19.0. Overrides `equals(java.lang.Object)`. Cite: `org/graalvm/collections/Pair.html#equals(java.lang.Object)` ### toString() `public String toString()`. Since 19.0. Overrides `toString()`. Cite: `org/graalvm/collections/Pair.html#toString()` ## Inherited members - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) # ◆ SeqLockPrefixTree [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 22.3. ```java public class SeqLockPrefixTree ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `SeqLockPrefixTree` Thread-safe prefix-tree implementation in which keys are sequences of 64-bit values, and the values are 64-bit values. The prefix tree supports a single operation `root`, which returns the root node. The nodes support the following operations: `at` to obtain a child node, `value` to obtain the value at the current node, `setValue` to atomically set the value and `incValue` to atomically increment the value. The prefix tree is implemented as follows. The tree points to the root node. Each node points to a set of child nodes, where each child is associated with a key. Each node additionally holds an arity, which is the number of children, and the 64-bit value of that node. The set of child nodes can be represented as `null` if the set is empty, an array-list if the set is small, or a hash table if the set is large. In all cases, the keys and the child nodes are kept in separate arrays. The `at` operation, which takes a node and a key, and returns the corresponding child node, deserves an additional explanation. This operation creates an existing child associated with the key, or atomically creates a new child, if there was no child for that key. The `at` operation is implemented as follows. There is a fast-path, which executes when the child node already exists, and there are no concurrent modifications at that node, and the slow-path, which executes when the child does not exist or when there is a concurrent modification. To ensure that the slow path does not obtain a monitor, the fast-path relies on a *seqlock*. This is a lightweight read-write lock that consists of a single 64-bit counter, whose value is even when the lock is in the read mode, and odd when the lock is in the write mode. The lock can be held by any number of readers, but at most 1 writer at any time. In the read-mode, the reader must verify that the value of the lock is even and that it did not change from the point when the read started until the point when the read ended, and additionally takes care that reading an invalid state does not crash the execution. If the read fails for either of these reasons, the reader proceeds to the write-mode. In the write-mode, the reader or the writer enters a heavy lock (i.e. monitor) and then increments the seqlock's value by one, does the modification, and then increments the seqlock's value by one to make it even again. The volatile access semantics of the seqlock's value, along with the fact that the node's data only "grows" over time, are the properties that ensure the correctness of this implementation. ## Nested types - [`SeqLockPrefixTree.Node`](org/graalvm/collections/SeqLockPrefixTree.Node.md) (class): No description. ## Constructors ### SeqLockPrefixTree() `public SeqLockPrefixTree()`. Since 22.3. Create new `SeqLockPrefixTree` with root being a Node with key 0. Cite: `org/graalvm/collections/SeqLockPrefixTree.html#()` ## Methods ### root() `public SeqLockPrefixTree.Node root()`. Since 22.3. The root node of the tree. Returns `SeqLockPrefixTree.Node`: the root of the tree. Cite: `org/graalvm/collections/SeqLockPrefixTree.html#root()` ## Inherited members - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`toString`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) # ◆ SeqLockPrefixTree.Node [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Class in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 22.3. Nested in [`SeqLockPrefixTree`](org/graalvm/collections/SeqLockPrefixTree.md). ```java public static final class SeqLockPrefixTree.Node extends AtomicLong ``` Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > [`Number`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Number.html) > [`AtomicLong`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html) > `Node` ## Methods ### value() `public long value()`. Since 22.3. Returns `long`: The value of the `LockFreePrefixTree.Node`. Cite: `org/graalvm/collections/SeqLockPrefixTree.Node.html#value()` ### incValue() `public long incValue()`. Since 22.3. Increment value. Returns `long`: newly incremented value of the `LockFreePrefixTree.Node`. Cite: `org/graalvm/collections/SeqLockPrefixTree.Node.html#incValue()` ### setValue(long) `public void setValue(long value)`. Since 22.3. Set the value for the `LockFreePrefixTree.Node`. Parameters: `value` `long`: the new value. Cite: `org/graalvm/collections/SeqLockPrefixTree.Node.html#setValue(long)` ### at(long) `public SeqLockPrefixTree.Node at(long key)`. Since 22.3. Get existing (or create if missing) child with the given key. Parameters: `key` `long`: the key of the child. Returns `SeqLockPrefixTree.Node`: The child with the given childKey. Cite: `org/graalvm/collections/SeqLockPrefixTree.Node.html#at(long)` ### seqlockValue() `public long seqlockValue()`. Since 22.3. Returns `long`: the value of the seqlock. Cite: `org/graalvm/collections/SeqLockPrefixTree.Node.html#seqlockValue()` ### topDown(C, BiFunction, BiConsumer) `public void topDown(C currentContext, BiFunction createContext, BiConsumer consumeValue)`. Since 22.3. Traverse the tree top-down while maintaining a context. The context is a generic data structure corresponding to the depth of the traversal, i.e. given the currentContext and a createContext function, a new context is created for each visited child using the createContext function, starting with initialContext. Type parameters: ``: The type of the context. Parameters: `currentContext` `C`: The context for the root of the tree. `createContext` `BiFunction`: A function defining how the context for children is created. `consumeValue` `BiConsumer`: A function that consumes the nodes value. Cite: `org/graalvm/collections/SeqLockPrefixTree.Node.html#topDown(C,java.util.function.BiFunction,java.util.function.BiConsumer)` ### toString() `public String toString()`. Since 22.3. Overrides `toString()`. Cite: `org/graalvm/collections/SeqLockPrefixTree.Node.html#toString()` ## Inherited members - From class [`AtomicLong`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html): [`accumulateAndGet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#accumulateAndGet%28long,java.util.function.LongBinaryOperator%29), [`addAndGet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#addAndGet%28long%29), [`compareAndExchange`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#compareAndExchange%28long,long%29), [`compareAndExchangeAcquire`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#compareAndExchangeAcquire%28long,long%29), [`compareAndExchangeRelease`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#compareAndExchangeRelease%28long,long%29), [`compareAndSet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#compareAndSet%28long,long%29), [`decrementAndGet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#decrementAndGet%28%29), [`doubleValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#doubleValue%28%29), [`floatValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#floatValue%28%29), [`get`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#get%28%29), [`getAcquire`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAcquire%28%29), [`getAndAccumulate`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndAccumulate%28long,java.util.function.LongBinaryOperator%29), [`getAndAdd`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndAdd%28long%29), [`getAndDecrement`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndDecrement%28%29), [`getAndIncrement`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndIncrement%28%29), [`getAndSet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndSet%28long%29), [`getAndUpdate`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getAndUpdate%28java.util.function.LongUnaryOperator%29), [`getOpaque`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getOpaque%28%29), [`getPlain`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#getPlain%28%29), [`incrementAndGet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#incrementAndGet%28%29), [`intValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#intValue%28%29), [`lazySet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#lazySet%28long%29), [`longValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#longValue%28%29), [`set`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#set%28long%29), [`setOpaque`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#setOpaque%28long%29), [`setPlain`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#setPlain%28long%29), [`setRelease`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#setRelease%28long%29), [`updateAndGet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#updateAndGet%28java.util.function.LongUnaryOperator%29), [`weakCompareAndSet`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#weakCompareAndSet%28long,long%29), [`weakCompareAndSetAcquire`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#weakCompareAndSetAcquire%28long,long%29), [`weakCompareAndSetPlain`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#weakCompareAndSetPlain%28long,long%29), [`weakCompareAndSetRelease`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#weakCompareAndSetRelease%28long,long%29), [`weakCompareAndSetVolatile`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/atomic/AtomicLong.html#weakCompareAndSetVolatile%28long,long%29) - From class [`Number`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Number.html): [`byteValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Number.html#byteValue%28%29), [`shortValue`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Number.html#shortValue%28%29) - From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`clone`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone%28%29), [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`finalize`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize%28%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29) # ◇ UnmodifiableEconomicMap [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Interface in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 19.0. ```java public interface UnmodifiableEconomicMap ``` Unmodifiable memory efficient map. See [`EconomicMap`](org/graalvm/collections/EconomicMap.md) for the underlying data structure and its properties. ## Methods ### get(K) `V get(K key)`. Since 19.0. Returns the value to which `key` is mapped, or `null` if this map contains no mapping for `key`. The `key` must not be `null`. Throws: `UnsupportedOperationException` (unchecked): if `key == null`. Cite: `org/graalvm/collections/UnmodifiableEconomicMap.html#get(K)` ### get(K, V) `default V get(K key, V defaultValue)`. Since 19.0. Returns the value to which `key` is mapped, or `defaultValue` if this map contains no mapping for `key`. The `key` must not be `null`. Maps that support {code null} values, need to overwrite this method to appropriately handle the {code null} case. Throws: `UnsupportedOperationException` (unchecked): if `key == null`. Cite: `org/graalvm/collections/UnmodifiableEconomicMap.html#get(K,V)` ### containsKey(K) `boolean containsKey(K key)`. Since 19.0. Returns `true` if this map contains a mapping for `key`. The `key` must not be `null`. Throws: `UnsupportedOperationException` (unchecked): if `key == null`. Cite: `org/graalvm/collections/UnmodifiableEconomicMap.html#containsKey(K)` ### size() `int size()`. Since 19.0. Returns the number of key-value mappings in this map. Cite: `org/graalvm/collections/UnmodifiableEconomicMap.html#size()` ### isEmpty() `boolean isEmpty()`. Since 19.0. Returns `true` if this map contains no key-value mappings. Cite: `org/graalvm/collections/UnmodifiableEconomicMap.html#isEmpty()` ### getValues() `Iterable getValues()`. Since 19.0. Returns a [`Iterable`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html) view of the values contained in this map. Cite: `org/graalvm/collections/UnmodifiableEconomicMap.html#getValues()` ### getKeys() `Iterable getKeys()`. Since 19.0. Returns a [`Iterable`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html) view of the keys contained in this map. Cite: `org/graalvm/collections/UnmodifiableEconomicMap.html#getKeys()` ### getEntries() `UnmodifiableMapCursor getEntries()`. Since 19.0. Returns a `UnmodifiableMapCursor` view of the mappings contained in this map. Cite: `org/graalvm/collections/UnmodifiableEconomicMap.html#getEntries()` ### getEquivalenceStrategy() `default Equivalence getEquivalenceStrategy()`. Since 23.0. Returns the strategy used to compare keys. Cite: `org/graalvm/collections/UnmodifiableEconomicMap.html#getEquivalenceStrategy()` # ◇ UnmodifiableEconomicSet [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Interface in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 19.0. ```java public interface UnmodifiableEconomicSet extends Iterable ``` Extends: [`Iterable`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html)`` Unmodifiable memory efficient set data structure. It does not support [looking up](org/graalvm/collections/UnmodifiableEconomicSet.md#contains%28E%29) a `null` element. ## Methods ### contains(E) `boolean contains(E element)`. Since 19.0. Returns `true` if this set contains a mapping for the `element`. Throws: `UnsupportedOperationException` (unchecked): if `element == null`. Cite: `org/graalvm/collections/UnmodifiableEconomicSet.html#contains(E)` ### size() `int size()`. Since 19.0. Returns the number of elements in this set. Cite: `org/graalvm/collections/UnmodifiableEconomicSet.html#size()` ### isEmpty() `boolean isEmpty()`. Since 19.0. Returns `true` if this set contains no elements. Cite: `org/graalvm/collections/UnmodifiableEconomicSet.html#isEmpty()` ### toArray(E[]) `default E[] toArray(E[] target)`. Since 19.0. Stores all the elements in this set into `target`. An [`UnsupportedOperationException`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/UnsupportedOperationException.html) will be thrown if the length of `target` does not match the size of this set. Returns `E[]`: an array containing all the elements in this set. Throws: `UnsupportedOperationException` (unchecked): if the length of `target` does not equal the size of this set. Cite: `org/graalvm/collections/UnmodifiableEconomicSet.html#toArray(E[])` ### toHashSet() `default HashSet toHashSet()`. Cite: `org/graalvm/collections/UnmodifiableEconomicSet.html#toHashSet()` ### toList() `default List toList()`. Cite: `org/graalvm/collections/UnmodifiableEconomicSet.html#toList()` ### containsAll(Iterable) `default boolean containsAll(Iterable coll)`. Cite: `org/graalvm/collections/UnmodifiableEconomicSet.html#containsAll(java.lang.Iterable)` ### removeIf(Predicate) `default boolean removeIf(Predicate filter)`. Cite: `org/graalvm/collections/UnmodifiableEconomicSet.html#removeIf(java.util.function.Predicate)` ## Inherited members - From interface [`Iterable`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html): [`forEach`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html#forEach%28java.util.function.Consumer%29), [`iterator`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html#iterator%28%29), [`spliterator`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Iterable.html#spliterator%28%29) # ◇ UnmodifiableMapCursor [collections](index.md) › [org.graalvm.collections](org/graalvm/collections/index.md) · Every page: [llms.txt](llms.txt) Interface in [`org.graalvm.collections`](org/graalvm/collections/index.md). Since 19.0. ```java public interface UnmodifiableMapCursor ``` Cursor to iterate over a map without changing its contents. ## Methods ### advance() `boolean advance()`. Since 19.0. Advances to the next entry. Returns `boolean`: `true` if a next entry exists, `false` if there is no next entry. Cite: `org/graalvm/collections/UnmodifiableMapCursor.html#advance()` ### getKey() `K getKey()`. Since 19.0. The key of the current entry. Cite: `org/graalvm/collections/UnmodifiableMapCursor.html#getKey()` ### getValue() `V getValue()`. Since 19.0. The value of the current entry. Cite: `org/graalvm/collections/UnmodifiableMapCursor.html#getValue()`