import { type MultiSetBase } from "https://deno.land/x/rimbu@1.2.0/multiset/custom/index.ts";
const { Builder } = MultiSetBase;
Type Parameters
optional
Tp extends MultiSetBase.Types = MultiSetBase.TypesMethods
Returns true if the given value
is present in the builder.
add(value: T, amount?: number): boolean
Adds given value
to the builder.
addAll(values: StreamSource<T>): boolean
Adds the values in given values
StreamSource
to the builder.
addEntries(entries: StreamSource<readonly [T, number]>): boolean
Adds for each tuple of a value and amount in the given entries
, the amount of values
to the builder.
Removes given amount
or all of given value
from the builder.
removeAllSingle<U = T>(values: StreamSource<RelatedTo<T, U>>): boolean
Removes every single value in given values
from the builder.
removeAllEvery<U = T>(values: StreamSource<RelatedTo<T, U>>): boolean
Removes every instance of the given values
from the builder.
setCount(value: T, amount: number): boolean
Sets the amount of given value
in the collection to amount
.
modifyCount(value: T, update: (currentCount: number) => number): boolean
Changes the amount of given value
in the builder according to the result of given update
function.
forEach(f: () => void, options?: { state?: TraverseState; }): void
Performs given function f
for each value of the collection, using given state
as initial traversal state.