Package: effect
Module: HashMap
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)
Signature
declare const endMutation: <K, V>(self: HashMap<K, V>) => HashMap<K, V>
Since v2.0.0