Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Class

HashMap<K, V>

class HashMap<K, V>

Module: System.Collections
Assembly: System.Runtime.dll
Source file: HashMap.rvn

Inheritance: Object → HashMap<K, V>
Implements: MutableMap<K, V>

A mutable hash table using an explicit key equality/hash policy or callbacks.

Remarks

Equal keys must have equal hashes, and keys must remain stable while stored. Hash and equality callbacks must not reenter the same map; reentry faults. Keys returns a shallow snapshot in insertion order. GetIterator returns a shallow snapshot of pairs in unspecified order; later insertions and replacements do not change captured pairs. Set preserves an existing key while replacing its value. No removal or concurrent-use contract is provided.

Constructors

4 items
HashMap(comparer: EqualityComparer<K>) Creates an empty map retaining a reusable key policy.
HashMap(items: Iterable<KeyValuePair<K, V>>, comparer: EqualityComparer<K>) Copies pairs into independent storage using the supplied key policy.
HashMap(items: Iterable<KeyValuePair<K, V>>, equal: (K, K) -> bool, hash: (K) -> int) Copies pairs using explicit equality and hash callbacks.

Properties

2 items
Count: int Gets the number of elements or entries. Implements Map<K, V>.Count
Keys: Sequence<K> Returns a shallow snapshot of keys in insertion order; later map mutations do not change this snapshot. Implements Map<K, V>.Keys

Indexers

1 item
Item[key: K]: V Gets an existing value, or inserts/replaces the value associated with a key. Implements MutableMap<K, V>.Item, Map<K, V>.Item

Methods

32 items
Extension member: All(predicate: (KeyValuePair<K, V>) -> bool) -> bool No summary available. Extension from Operators.All
Extension member: Any(predicate: (KeyValuePair<K, V>) -> bool) -> bool No summary available. Extension from Operators.Any
Extension member: Any() -> bool Tests whether the source contains an element, or an element satisfying the supplied predicate. Extension from Operators.Any
Extension member: Concat(second: Iterable<KeyValuePair<K, V>>) -> Iterable<KeyValuePair<K, V>> Enumerates the first source followed by the second source. Extension from Operators.Concat
ContainsKey(key: K) -> bool Tests whether the map contains an entry for the supplied key. Implements Map<K, V>.ContainsKey
Extension member: Count(predicate: (KeyValuePair<K, V>) -> bool) -> int No summary available. Extension from Operators.Count
Extension member: Count() -> int Counts source elements, optionally restricted by the supplied predicate. Extension from Operators.Count
Extension member: Entry(key: K) -> MapEntry<K, V> Creates a reusable live locator without looking up or inserting the key. Extension from MutableMapExtensions.Entry
Equals(other: object?) -> bool Tests reference identity by default; an ordinary class may override equality. Inherited from Object.Equals
Extension member: Filter(predicate: (KeyValuePair<K, V>) -> bool) -> Iterable<KeyValuePair<K, V>> No summary available. Extension from Operators.Filter
Find(key: K) -> Optional<V> Returns the value associated with the key, or None when the key is absent. Implements Map<K, V>.Find
Extension member: First(predicate: (KeyValuePair<K, V>) -> bool) -> Optional<KeyValuePair<K, V>> No summary available. Extension from Operators.First
Extension member: First() -> Optional<KeyValuePair<K, V>> Returns the first source element matching the optional predicate, or None when none exists. Extension from Operators.First
Extension member: FlatMap<U>(selector: (KeyValuePair<K, V>) -> Iterable<U>) -> Iterable<U> No summary available. Extension from Operators.FlatMap
Extension member: Fold<U>(seed: U, accumulator: (U, KeyValuePair<K, V>) -> U) -> U No summary available. Extension from Operators.Fold
GetHashCode() -> int Returns a stable identity hash by default; an ordinary class may override it consistently with equality. Inherited from Object.GetHashCode
GetIterator() -> Iterator<KeyValuePair<K, V>> Returns a shallow snapshot of key/value pairs in unspecified order. Implements Iterable<KeyValuePair<K, V>>.GetIterator
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
Extension member: Last(predicate: (KeyValuePair<K, V>) -> bool) -> Optional<KeyValuePair<K, V>> No summary available. Extension from Operators.Last
Extension member: Last() -> Optional<KeyValuePair<K, V>> Returns the last source element matching the optional predicate, or None when none exists. Extension from Operators.Last
Extension member: Map<U>(selector: (KeyValuePair<K, V>) -> U) -> Iterable<U> No summary available. Extension from Operators.Map
Extension member: OfType<U>() -> Iterable<U> Lazily retains non-null elements compatible with the requested result type, preserving order. Extension from Operators.OfType
Set(key: K, value: V) -> () Inserts a missing key or replaces the value associated with an existing key. Implements MutableMap<K, V>.Set
Extension member: Single() -> Result<KeyValuePair<K, V>, SingleError> Returns the sole matching element, or SingleError.Empty or SingleError.Multiple for a cardinality mismatch. Extension from Operators.Single
Extension member: Skip(count: int) -> Iterable<KeyValuePair<K, V>> Returns an iterable that skips the requested number of leading elements. Extension from Operators.Skip
Extension member: Take(count: int) -> Iterable<KeyValuePair<K, V>> Returns an iterable containing at most the requested number of leading elements. Extension from Operators.Take
Extension member: ToList() -> ArrayList<KeyValuePair<K, V>> Materializes the source into a new ArrayList in enumeration order. Extension from Operators.ToList
Extension member: ToMap(comparer: EqualityComparer<K>) -> HashMap<K, V> Copies pairs into a new map using an explicit key comparer. Extension from MapOperators.ToMap
ToString() -> string Returns the concrete runtime type name for supported references, or display text from a class or boxed-struct override. Inherited from Object.ToString
TryAdd(key: K, value: V) -> bool Inserts the key and value only when the key is absent; returns false without replacing an existing entry. Implements MutableMap<K, V>.TryAdd