Skip to main content

class BiMultiMapContext<UK,UV,N,Tp>

undocumented

Implements: BiMultiMapBase.Context<UK,UV,Tp>

Type parameters​

NameConstraintsDefaultDescription
UKundocumented
UVundocumented
Nstringundocumented
TpContextTypesImplContextTypesImplundocumented

Properties​

_empty​

undocumented

Definition​

readonly _empty: WithKeyValue<Tp, UK, UV>["normal"];

_fixTypes​

undocumented

Definition​

readonly _fixTypes: any;

Overrides​

Context._fixTypes

_types​

undocumented

Definition​

get _types(): Tp;

Overrides​

Context._types

builder​

undocumented

Definition​

readonly builder: <K extends UK, V extends UV>() => WithKeyValue<Tp, K, V>["builder"];

empty​

undocumented

Definition​

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

from​

undocumented

Definition​

readonly from: <K extends UK, V extends UV>(...sources: ArrayNonEmpty<StreamSource<readonly [K, V]>>) => [K, V] extends [UK, UV] ? WithKeyValue<Tp, K, V>["normal"] | any : never;

keyValueMultiMapContext​

undocumented

Definition​

readonly keyValueMultiMapContext: WithKeyValue<Tp, UK, UV>['keyValueMultiMapContext'];

Overrides​

Context.keyValueMultiMapContext

of​

undocumented

Definition​

readonly of: any;

reducer​

undocumented

Definition​

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

typeTag​

undocumented

Definition​

readonly typeTag: N;

Overrides​

Context.typeTag

valueKeyMultiMapContext​

undocumented

Definition​

readonly valueKeyMultiMapContext: WithKeyValue<Tp, UK, UV>['valueKeyMultiMapContext'];

Overrides​

Context.valueKeyMultiMapContext

Methods​

builder​

Returns an empty BiMultiMap builder instance.

Definition​

builder<K extends UK, V extends UV>(): WithKeyValue<Tp, K, V>['builder'];

Type parameters​

NameConstraintsDescription
KUK
VUV
example
HashBiMultiMap.builder<number, string>()    // => HashBiMultiMap.Builder<number, string>

Overrides​

Factory.builder

createBuilder​

undocumented

Definition​

createBuilder<K extends UK, V extends UV>(source?: WithKeyValue<Tp, K, V>['nonEmpty']): WithKeyValue<Tp, K, V>['builder'];

Type parameters​

NameConstraintsDescription
KUK
VUV

Parameters​

NameTypeDescription
sourceWithKeyValue<Tp, K, V>['nonEmpty']

createNonEmpty​

undocumented

Definition​

createNonEmpty<K, V>(keyValueMultiMap: WithKeyValue<Tp, K, V>['keyValueMultiMapNonEmpty'], valueKeyMultiMap: WithKeyValue<Tp, K, V>['valueKeyMultiMapNonEmpty']): WithKeyValue<Tp, K, V>['nonEmpty'];

Type parameters​

NameDescription
K
V

Parameters​

NameTypeDescription
keyValueMultiMapWithKeyValue<Tp, K, V>['keyValueMultiMapNonEmpty']
valueKeyMultiMapWithKeyValue<Tp, K, V>['valueKeyMultiMapNonEmpty']

empty​

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

Definition​

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

Type parameters​

NameConstraintsDescription
KUK
VUV
example
HashBiMultiMap.empty<number, string>()    // => HashBiMultiMap<number, string>
HashBiMultiMap.empty<string, boolean>() // => HashBiMultiMap<string, boolean>

Overrides​

Factory.empty

from​

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

Definitions​

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

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

Type parameters​

NameConstraintsDescription
KUK
VUV

Parameters​

NameTypeDescription
sourcesArrayNonEmpty<StreamSource.NonEmpty<readonly [K, V]>>an array of StreamSource instances containing key-value entries
example
HashBiMultiMap.from([[1, 'a'], [2, 'b']])    // => HashBiMultiMap.NonEmpty<number, string>

Overrides​

Factory.from

of​

Returns an immutable BiMultiMap, containing the given entries.

Definition​

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

Type parameters​

NameConstraintsDescription
KUK
VUV

Parameters​

NameTypeDescription
entriesArrayNonEmpty<readonly [K, V]>a non-empty array of key-value entries
example
HashBiMultiMap.of([1, 'a'], [2, 'b'])    // => HashBiMultiMap.NonEmpty<number, string>

Overrides​

Factory.of

reducer​

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.

Definition​

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

Type parameters​

NameConstraintsDescription
KUK
VUV

Parameters​

NameTypeDescription
sourceStreamSource<readonly [K, V]>(optional) an initial source of tuples to add to
example
const someSource = BiMultiMap.of([1, 'a'], [2, 'b']);
const result = Stream.of([1, 'c'], [3, 'a']).reduce(BiMultiMap.reducer(someSource))
result.toArray() // => [[1, 'a'], [1, 'c'], [2, 'b'], [3, 'a']]
note

uses a builder under the hood. If the given source is a BiMultiMap in the same context, it will directly call .toBuilder().

Overrides​

Factory.reducer