Skip to main content
Module

x/rimbu/bimultimap/custom/index.ts>BiMultiMapBase.Builder

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

Properties

readonly
size: number

Returns the amount of entries in the builder.

readonly
isEmpty: boolean

Returns true if there are no entries in the builder.

Methods

hasKey<UK = K>(key: RelatedTo<K, UK>): boolean

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

hasValue<UV = V>(value: RelatedTo<V, UV>): boolean

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

hasEntry<UK = K, UV = V>(key: RelatedTo<K, UK>, value: RelatedTo<V, UV>): boolean

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

getValues<UK = K>(key: RelatedTo<K, UK>): WithKeyValue<Tp, K, V>["keyMultiMapValues"]

Returns a collection representing the values currently associated with given key.

getKeys<UV = V>(value: RelatedTo<V, UV>): WithKeyValue<Tp, K, V>["valueMultiMapValues"]

Returns a collection representing the keys currently associated with given value.

setValues(key: K, values: StreamSource<V>): boolean

Sets the values associated to given key to the values in the given values StreamSource.

setKeys(value: V, keys: StreamSource<K>): boolean

Sets the keys associated to given value to the keys in the given keys StreamSource.

add(key: K, value: V): boolean

Associates given key with given value in the builder.

addEntries(entries: StreamSource<readonly [K, V]>): boolean

Adds given entries to the builder.

removeKey<UK = K>(key: RelatedTo<K, UK>): boolean

Removes the entries related to given key from the builder.

removeKeys<UK = K>(keys: StreamSource<RelatedTo<K, UK>>): boolean

Removes the entries related to the given keys StreamSource from the builder.

removeValue<UV = V>(value: RelatedTo<V, UV>): boolean

Removes the entries related to given value from the builder.

removeValues<UV = V>(values: StreamSource<RelatedTo<V, UV>>): boolean

Removes the entries related to the given values StreamSource from the builder.

removeEntry<UK = K, UV = V>(key: RelatedTo<K, UK>, value: RelatedTo<V, UV>): boolean

Removes the entry of given key and value from the builder.

removeEntries<UK = K, UV = V>(entries: StreamSource<[RelatedTo<K, UK>, RelatedTo<V, UV>]>): boolean

Removes the entries in the given entries StreamSource from the builder.

forEach(f: (
entry: [K, V],
index: number,
halt: () => void,
) => void
, state?: TraverseState
): void

Performs given function f for each entry of the builder.

build(): WithKeyValue<Tp, K, V>["normal"]

Returns an immutable collection instance containing the entries in this builder.