Hyperlinkv0.8.0-beta.28

MutableHashMap

MutableHashMap.emptyconsteffect/MutableHashMap.ts:154
<K, V>(): MutableHashMap<K, V>

Creates an empty MutableHashMap.

When to use

Use to create a fresh mutable map before adding entries over time.

Details

Each call returns a new empty map instance.

Example (Creating an empty map)

import { MutableHashMap } from "effect"

const map = MutableHashMap.empty<string, number>()

// Add some entries
MutableHashMap.set(map, "key1", 42)
MutableHashMap.set(map, "key2", 100)

console.log(MutableHashMap.size(map)) // 2
constructorsmakefromIterable
export const empty = <K, V>(): MutableHashMap<K, V> => {
  const self = Object.create(MutableHashMapProto)
  self.backing = new Map()
  self.buckets = new Map()
  return self
}
Referenced by 7 symbols