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

x/rimbu/multiset/custom/index.ts>MultiSetBase

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
namespace MultiSetBase
Re-export
import { MultiSetBase } from "https://deno.land/x/rimbu@1.2.0/multiset/custom/index.ts";

Interfaces

Utility interface that provides higher-kinded types for this collection.

interface MultiSetBase
implements VariantMultiSetBase<T, Tp>
Re-export
import { type MultiSetBase } from "https://deno.land/x/rimbu@1.2.0/multiset/custom/index.ts";

Properties

readonly
context: WithElem<Tp, T>["context"]

Returns the context associated to this collection instance.

Methods

add(value: T): WithElem<Tp, T>["nonEmpty"]

Returns the collection with the given value added amount times.

add(value: T, amount: number): WithElem<Tp, T>["normal"]
addAll(values: StreamSource.NonEmpty<T>): WithElem<Tp, T>["nonEmpty"]

Returns the collection with the values in values added.

addAll(values: StreamSource<T>): WithElem<Tp, T>["normal"]
addEntries(entries: StreamSource<readonly [T, number]>): WithElem<Tp, T>["normal"]

Returns the collection where for every entry in entries consisting of a tuple of a value and an amount, that value is added amount times.

setCount(value: T, amount: number): WithElem<Tp, T>["normal"]

Returns the collection where the amount of values of value if set to amount.

modifyCount(value: T, update: (currentCount: number) => number): WithElem<Tp, T>["normal"]

Returns the collection where the count of the given value is modified according to the given update function.

toBuilder(): WithElem<Tp, T>["builder"]

Returns a builder object containing the entries of this collection.