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
Name | Description |
---|---|
K | the key type |
V | the value type |
note
- The
HashMap
uses the context'shasher
instance to hash keys for performance.
- TheHashMap
uses the context'seq
function to determine equivalence between keys.
example
const m1 = HashMap.empty<number, string>()
const m2 = HashMap.of([1, 'a'], [2, 'b'])