# collections 25.6.0-elide.4 > API reference for collections. Each page below is Markdown; the HTML page of the same name has the same content. llms-full.txt has every page in one file, and api.json is the apidocs/1 model. ## When to use this Use this API reference when you write, read or review code that uses collections 25.6.0-elide.4. ## Overview - [⬢ collections](index.md): packages and types - [Alphabetical index](index-all.md): find `Type.member` or search by behavior. Check the declaring type and overload, then follow the matching link. - [Declaration contracts](contracts.ndjson): full structured records for a known `Type.member`, including documented parameters, returns and throws. - [llms-full.txt](llms-full.txt): every page in one file - [api.json](api.json): the apidocs/1 model ## Pages - [▣ Package org.graalvm.collections](org/graalvm/collections/index.md): The GraalVM SDK collections package contains memory efficient data structures. - [◇ EconomicMap (interface in org.graalvm.collections)](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. put(K, V): Associates value with key in this map. Returns: the previous value associated with key, or null if there was no mapping for key. Throws: UnsupportedOperationException - if key == null putIfAbsent(K, V): 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. Returns: the previous value assoc putAll(EconomicMap): Copies all the mappings from other to this map. putAll(UnmodifiableEconomicMap): Copies all the mappings from other to this map. clear(): Removes all the mappings - [◆ EconomicMapUtil (class in org.graalvm.collections)](org/graalvm/collections/EconomicMapUtil.md): Utility methods for the EconomicMap. equals(UnmodifiableEconomicMap, UnmodifiableEconomicMap): Compares maps for equality. Returns: true iff the maps are equal hashCode(UnmodifiableEconomicMap): Computes an order-independent hash code for an EconomicMap. Returns: the hash code of the map keySet(EconomicMap): Returns an EconomicSet of the keys contained in a map. Returns: an EconomicSet of the keys contained in a map lexicographicalComparator(Comparator, Comparator): Creates a lexicographical map comparator using the provided key and value comparators. Returns: a lexicographical map comparator - [◆ EconomicMapWrap (class in org.graalvm.collections)](org/graalvm/collections/EconomicMapWrap.md): Wraps an existing Map as an EconomicMap. get(K): Returns the value to which key is mapped, or null if this map contains no mapping for key. get(K, V): Returns the value to which key is mapped, or defaultValue if this map contains no mapping for key. Throws: UnsupportedOperationException - if key == null put(K, V): Associates value with key in this map. Returns: the previous value associated with key, or null if there was no mapping for key. putIfAbsent(K, V): 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. Returns: - [◇ EconomicSet (interface in org.graalvm.collections)](org/graalvm/collections/EconomicSet.md): Memory efficient set data structure. add(E): Adds non-null element to this set if it is not already present. Returns: true if this set did not already contain element Throws: UnsupportedOperationException - if element == null remove(E): Removes non-null element from this set if it is present. Throws: UnsupportedOperationException - if element == null clear(): Removes all the elements from this set. addAll(EconomicSet): Adds all the elements in other to this set if they're not already present. addAll(Iterable): Adds all the elements in values to this set if they're not already present. addAll(Iterator): Adds all the elements enume - [◆ Equivalence (abstract class in org.graalvm.collections)](org/graalvm/collections/Equivalence.md): Strategy for comparing two objects. DEFAULT: Default equivalence calling equals(Object) to check equality and hashCode() for obtaining hash values. IDENTITY: Identity equivalence using == to check equality and hashCode() for obtaining hash values. IDENTITY_WITH_SYSTEM_HASHCODE: Identity equivalence using == to check equality and System.identityHashCode(Object) for obtaining hash values. Equivalence(): Subclass for creating custom equivalence definitions. equals(Object, Object): Returns true if the non-null arguments are equal to each other and false otherwise. hashCode(Object): Returns the hash code of a non-null argument o. - [◆ LockFreePool (class in org.graalvm.collections)](org/graalvm/collections/LockFreePool.md): Concurrent lock-free pool data structure. get(): Returns a previously added element. Returns: A previously added element, or null if there are no previously added elements that have not been already returned. add(T): Adds an element to this pool. - [◆ LockFreePrefixTree (class in org.graalvm.collections)](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. LockFreePrefixTree(LockFreePrefixTree.Allocator): Create new LockFreePrefixTree with root being a Node with key 0. root(): The root node of the tree. Returns: the root of the tree reset(): Resets the tree. topDown(C, BiFunction, BiConsumer): Traverse the tree top-down while maintaining a context. - [◆ LockFreePrefixTree.Allocator (abstract class in org.graalvm.collections)](org/graalvm/collections/LockFreePrefixTree.Allocator.md): Policy for allocating objects of the lock-free prefix tree. newNode(long): Allocates a new Node object. Returns: A fresh Node object, possibly preallocated. Throws: LockFreePrefixTree.FailedAllocationException - If the allocation request cannot be fulfilled. newLinearChildren(int): Allocates a new reference array of child nodes stored linearly. Returns: A fresh array, possibly preallocated. Throws: LockFreePrefixTree.FailedAllocationException - If the allocation request cann newHashChildren(int): Allocates a new reference array of child nodes stored as a hash table. Returns: A fresh array, possibly preallocated. Throws: LockFreePrefixTree.FailedAllocat - [◆ LockFreePrefixTree.HeapAllocator (class in org.graalvm.collections)](org/graalvm/collections/LockFreePrefixTree.HeapAllocator.md): Allocator that allocates objects directly on the managed heap. newNode(long): Allocates a new Node object. Returns: A fresh Node object, possibly preallocated. newLinearChildren(int): Allocates a new reference array of child nodes stored linearly. Returns: A fresh array, possibly preallocated. newHashChildren(int): Allocates a new reference array of child nodes stored as a hash table. Returns: A fresh array, possibly preallocated. shutdown(): Releases the allocator's resources. - [◆ LockFreePrefixTree.Node (class in org.graalvm.collections)](org/graalvm/collections/LockFreePrefixTree.Node.md): value(): Returns: The value of the Node setValue(long): Set the value for the Node. incValue(): Increment value. Returns: newly incremented value of the Node. bitwiseOrValue(long): Atomically does the bitwise-or on the current value. Returns: the value immediately after the bitwise-or operation at(LockFreePrefixTree.Allocator, long): Get existing (or create if missing) child with the given key. Returns: The child with the given childKey, or null if cannot complete. - [◆ LockFreePrefixTree.ObjectPoolingAllocator (class in org.graalvm.collections)](org/graalvm/collections/LockFreePrefixTree.ObjectPoolingAllocator.md): Allocator that internally maintains several pools of preallocated objects, and allocates objects from those pools. newNode(long): Allocates a new Node object. Returns: A fresh Node object, possibly preallocated. newLinearChildren(int): Allocates a new reference array of child nodes stored linearly. Returns: A fresh array, possibly preallocated. newHashChildren(int): Allocates a new reference array of child nodes stored as a hash table. Returns: A fresh array, possibly preallocated. shutdown(): Releases the allocator's resources. - [◇ MapCursor (interface in org.graalvm.collections)](org/graalvm/collections/MapCursor.md): Cursor to iterate over a mutable map. remove(): Remove the current entry from the map. setValue(V): Set the value of the current entry. Returns: previous value associated with the current key. - [◆ Pair (class in org.graalvm.collections)](org/graalvm/collections/Pair.md): Utility class representing a pair of values. empty(): Returns an empty pair. createLeft(L): Constructs a pair with its left value being left, or returns an empty pair if left is null. Returns: the constructed pair or an empty pair if left is null. createRight(R): Constructs a pair with its right value being right, or returns an empty pair if right is null. Returns: the constructed pair or an empty pair if right is null. create(L, R): 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: the constructed pair or an empty pair if both inputs are null. ge - [◆ SeqLockPrefixTree (class in org.graalvm.collections)](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. SeqLockPrefixTree(): Create new SeqLockPrefixTree with root being a Node with key 0. root(): The root node of the tree. Returns: the root of the tree - [◆ SeqLockPrefixTree.Node (class in org.graalvm.collections)](org/graalvm/collections/SeqLockPrefixTree.Node.md): value(): Returns: The value of the LockFreePrefixTree.Node incValue(): Increment value. Returns: newly incremented value of the LockFreePrefixTree.Node. setValue(long): Set the value for the LockFreePrefixTree.Node. at(long): Get existing (or create if missing) child with the given key. Returns: The child with the given childKey. seqlockValue(): Returns: the value of the seqlock. topDown(C, BiFunction, BiConsumer): Traverse the tree top-down while maintaining a context. - [◇ UnmodifiableEconomicMap (interface in org.graalvm.collections)](org/graalvm/collections/UnmodifiableEconomicMap.md): Unmodifiable memory efficient map. get(K): Returns the value to which key is mapped, or null if this map contains no mapping for key. Throws: UnsupportedOperationException - if key == null get(K, V): Returns the value to which key is mapped, or defaultValue if this map contains no mapping for key. Throws: UnsupportedOperationException - if key == null containsKey(K): Returns true if this map contains a mapping for key. Throws: UnsupportedOperationException - if key == null size(): Returns the number of key-value mappings in this map. isEmpty(): Returns true if this map contains no key-value mappings. getValues(): Returns a Iter - [◇ UnmodifiableEconomicSet (interface in org.graalvm.collections)](org/graalvm/collections/UnmodifiableEconomicSet.md): Unmodifiable memory efficient set data structure. contains(E): Returns true if this set contains a mapping for the element. Throws: UnsupportedOperationException - if element == null size(): Returns the number of elements in this set. isEmpty(): Returns true if this set contains no elements. toArray(E\[\]): Stores all the elements in this set into target. Returns: an array containing all the elements in this set. Throws: UnsupportedOperationException - if the length of target does not equal the size of this se - [◇ UnmodifiableMapCursor (interface in org.graalvm.collections)](org/graalvm/collections/UnmodifiableMapCursor.md): Cursor to iterate over a map without changing its contents. advance(): Advances to the next entry. Returns: true if a next entry exists, false if there is no next entry. getKey(): The key of the current entry. getValue(): The value of the current entry. ## Indexes - [Packages](packages.md): every package with its summary and type counts - [All types](types.md): every type, nested ones too, by name - [Index](index-all.md): every declaration from A to Z