Skip to main content
Module

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

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
namespace BiMultiMapBase
Re-export
import { BiMultiMapBase } from "https://deno.land/x/rimbu@0.14.0/bimultimap/custom/index.ts";
interface BiMultiMapBase
implements FastIterable<[K, V]>
Re-export
import { type BiMultiMapBase } from "https://deno.land/x/rimbu@0.14.0/bimultimap/custom/index.ts";

Properties

readonly
context: WithKeyValue<Tp, K, V>["context"]

Returns the context associated to this collection instance.

readonly
keyValueMultiMap: WithKeyValue<Tp, K, V>["keyValueMultiMap"]

Returns the MultiMap representation of the key to value mapping.

readonly
valueKeyMultiMap: WithKeyValue<Tp, K, V>["valueKeyMultiMap"]

Returns the MultiMap representation of the value to key mapping.

readonly
isEmpty: boolean

Returns false since this collection is known to be non-empty.

readonly
keySize: number

Returns the number of keys

readonly
size: number

Returns the number of entries

Methods

stream(): Stream<[K, V]>

Returns a Stream containing all entries of this collection as tuples of key and value.

streamKeys(): Stream<K>

Returns a Stream containing all keys of this collection.

streamValues(): Stream<V>

Returns a Stream containing all values of this collection.

assumeNonEmpty(): WithKeyValue<Tp, K, V>["nonEmpty"]

Returns the collection as a .NonEmpty type

nonEmpty(): this is WithKeyValue<Tp, K, V>["nonEmpty"]

Returns true if there is at least one entry in the collection, and instructs the compiler to treat the collection as a .NonEmpty type.

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

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

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

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

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

Returns true if the given key and value entry is in the collection.

add(key: K, value: V): WithKeyValue<Tp, K, V>["nonEmpty"]

Returns the collection with the given key associated to the given value.

addEntries(entries: StreamSource.NonEmpty<readonly [K, V]>): WithKeyValue<Tp, K, V>["nonEmpty"]

Returns the collection with the entries from the given StreamSource entries added.

addEntries(entries: StreamSource<readonly [K, V]>): WithKeyValue<Tp, K, V>["normal"]
setValues(key: K, values: StreamSource.NonEmpty<V>): WithKeyValue<Tp, K, V>["nonEmpty"]

Returns the collection with the values from the given values StreamSource associated with the given key.

setValues(key: K, values: StreamSource<V>): WithKeyValue<Tp, K, V>["normal"]
setKeys(value: V, keys: StreamSource.NonEmpty<K>): WithKeyValue<Tp, K, V>["nonEmpty"]

Returns the collection with the keys from the given keys StreamSource associated with the given value.

setKeys(value: V, keys: StreamSource<K>): WithKeyValue<Tp, K, V>["normal"]
getValues<UK = K>(key: RelatedTo<K, UK>): WithKeyValue<Tp, K, V>["keyMultiMapValues"]

Returns a collection containing the values associated with the given key.

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

Returns a collection containing the keys associated with the given value.

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

Returns the collection where the entries associated with given key are removed if it was part of the collection.

removeKeys<UK = K>(keys: StreamSource<RelatedTo<K, UK>>): WithKeyValue<Tp, K, V>["normal"]

Returns the collection where the entries associated with each key in given keys are removed if they were present.

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

Returns the collection where the entries associated with given value are removed if it was part of the collection.

removeValues<UV = V>(values: StreamSource<RelatedTo<V, UV>>): WithKeyValue<Tp, K, V>["normal"]

Returns the collection where the entries associated with each value in given values are removed if they were present.

removeEntry<UK = K, UV = V>(key: RelatedTo<K, UK>, value: RelatedTo<V, UV>): WithKeyValue<Tp, K, V>["normal"]

Returns the collection where the entry with given key or value is removed if present.

removeEntries<UK = K, UV = V>(entries: StreamSource<[RelatedTo<K, UK>, RelatedTo<V, UV>]>): WithKeyValue<Tp, K, V>["normal"]

Returns the collection where the entries in the given entries StreamSource are removed if present.

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

Performs given function f for each entry of the collection, using given state as initial traversal state.

filter(pred: (
entry: [K, V],
index: number,
halt: () => void,
) => boolean
): WithKeyValue<Tp, K, V>["normal"]

Returns a collection containing only those entries that satisfy given pred predicate.

toArray(): [K, V][]

Returns an array containing all entries in this collection.

toString(): string

Returns a string representation of this collection.

toJSON(): ToJSON<[K, V[]][], this["context"]["typeTag"]>

Returns a JSON representation of this collection.

toBuilder(): WithKeyValue<Tp, K, V>["builder"]

Returns a builder object containing the entries of this collection.