Skip to main content
Module

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

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

Type Parameters

optional
UK = unknown
optional
UV = unknown

Methods

empty<K extends UK, V extends UV>(): WithKeyValue<Tp, K, V>["normal"]

Returns the (singleton) empty instance of this type and context with given key and value types.

of<K extends UK, V extends UV>(...entries: ArrayNonEmpty<readonly [K, V]>): WithKeyValue<Tp, K, V>["nonEmpty"]

Returns an immutable BiMultiMap, containing the given entries.

from<K extends UK, V extends UV>(...sources: ArrayNonEmpty<StreamSource.NonEmpty<readonly [K, V]>>): WithKeyValue<Tp, K, V>["nonEmpty"]

Returns an immutable BiMultiMap, containing the entries in the given sources StreamSource instances.

from<K extends UK, V extends UV>(...sources: ArrayNonEmpty<StreamSource<readonly [K, V]>>): WithKeyValue<Tp, K, V>["normal"]
builder<K extends UK, V extends UV>(): WithKeyValue<Tp, K, V>["builder"]

Returns an empty BiMultiMap builder instance.

reducer<K extends UK, V extends UV>(source?: StreamSource<readonly [K, V]>): Reducer<[K, V], WithKeyValue<Tp, K, V>["normal"]>

Returns a Reducer that adds received tuples to a BiMultiMap and returns the BiMultiMap as a result. When a source is given, the reducer will first create a BiMultiMap from the source, and then add tuples to it.