effect-io-ai

Package: effect
Module: MutableHashSet

MutableHashSet.clear

Removes all values from the MutableHashSet.

This function operates by delegating the clearing action to the underlying key map associated with the given MutableHashSet. It ensures that the hash set becomes empty while maintaining its existence and structure.

Example

import { MutableHashSet, pipe } from "effect"
import assert from "node:assert/strict"

assert.deepStrictEqual(
  pipe(
    MutableHashSet.make(1, 2, 3, 4),
    MutableHashSet.clear,
    MutableHashSet.size
  ),
  0
)

See

Signature

declare const clear: <V>(self: MutableHashSet<V>) => MutableHashSet<V>

Source

Since v2.0.0