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

x/rimbu/multimap/custom/interface/base.ts>MultiMapBase.Factory

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

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 multimap of this collection type and context, 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 multimap of this type and context, containing the entries in the given source StreamSource.

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 builder instance for this type of collection and context.

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 MultiMap and returns the MultiMap as a result. When a source is given, the reducer will first create a MultiMap from the source, and then add tuples to it.