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

x/rimbu/bimap/custom/index.ts>BiMapFactory

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

Type Parameters

optional
UK = unknown
optional
UV = unknown

Methods

empty<K extends UK, V extends UV>(): BiMap<K, V>

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]>): BiMap.NonEmpty<K, V>

Returns an immutable BiMap, containing the given entries.

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

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

from<K extends UK, V extends UV>(...sources: ArrayNonEmpty<StreamSource.NonEmpty<readonly [K, V]>>): BiMap<K, V>
builder<K extends UK, V extends UV>(): BiMap.Builder<K, V>

Returns an empty BiMap builder instance.

reducer<K extends UK, V extends UV>(source?: StreamSource<readonly [K, V]>): Reducer<readonly [K, V], BiMap<K, V>>

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