Skip to main content

interface HashMap<K,V>

A type-invariant immutable Map of key type K, and value type V. In the Map, each key has exactly one value, and the Map cannot contain duplicate keys. See the Map documentation and the HashMap API documentation

Companion namespace: HashMap

Implemented by: HashMapEmpty<K,V>, HashMap.NonEmpty<K,V>

Type parameters

NameDescription
Kthe key type
Vthe value type
note
  • The HashMap uses the context's hasher instance to hash keys for performance.
    - The HashMap uses the context's eq function to determine equivalence between keys.
example
const m1 = HashMap.empty<number, string>()
const m2 = HashMap.of([1, 'a'], [2, 'b'])