Hyperlinkv0.8.0-beta.28

HashMap

HashMap.endMutationconsteffect/HashMap.ts:746
<K, V>(self: HashMap<K, V>): HashMap<K, V>

Marks the HashMap as immutable, completing the mutation cycle.

Example (Ending batch mutation)

import { HashMap } from "effect"

// Start with an existing map
const original = HashMap.make(["x", 10], ["y", 20])

// Begin mutation for batch operations
const mutable = HashMap.beginMutation(original)

// Perform multiple efficient operations
HashMap.set(mutable, "z", 30)
HashMap.remove(mutable, "x")
HashMap.set(mutable, "w", 40)

// End mutation to get final immutable result
const final = HashMap.endMutation(mutable)

console.log(HashMap.size(final)) // 3
console.log(HashMap.has(final, "x")) // false
console.log(HashMap.get(final, "z")) // Option.some(30)
mutations
Source effect/HashMap.ts:7461 lines
export const endMutation: <K, V>(self: HashMap<K, V>) => HashMap<K, V> = internal.endMutation