Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/collection-types/set-custom/interface/base.ts>RSetBase.Builder

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
interface RSetBase.Builder
import { type RSetBase } from "https://deno.land/x/rimbu@1.1.0/collection-types/set-custom/interface/base.ts";
const { Builder } = RSetBase;

Type Parameters

T
optional
Tp extends RSetBase.Types = RSetBase.Types

Properties

readonly
size: number

Returns the amount of values in the builder.

readonly
isEmpty: boolean

Returns true if there are no values in the builder.

Methods

has<U = T>(value: RelatedTo<T, U>): boolean

Returns true if the given value is present in the builder.

add(value: T): boolean

Adds given value to the builder.

addAll(values: StreamSource<T>): boolean

Adds the values in given values StreamSource to the builder.

remove<U = T>(value: RelatedTo<T, U>): boolean

Remove the given value from the builder.

removeAll<U = T>(values: StreamSource<RelatedTo<T, U>>): boolean

Removes the values in given values StreamSource from this builder.

forEach(f: (
value: T,
index: number,
halt: () => void,
) => void
, options?: { state?: TraverseState; }
): void

Performs given function f for each value of the builder.

build(): WithElem<Tp, T>["normal"]

Returns an immutable instance containing the values in this builder.