Skip to main content

class BiMapContext<UK,UV,Tp>

undocumented

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

Type parameters

NameConstraintsDefaultDescription
UKundocumented
UVundocumented
TpBiMap.TypesBiMap.Typesundocumented

Properties

_empty

undocumented

Definition

readonly _empty: BiMap<any, any>;

_types

undocumented

Definition

get _types(): Tp;

Overrides

Context._types

builder

undocumented

Definition

readonly builder: <K extends UK, V extends UV>() => BiMap.Builder<K, V>;

empty

undocumented

Definition

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

from

undocumented

Definition

readonly from: <K, V>(sources_0: StreamSource<readonly [K, V]>, ...sources_1: StreamSource<readonly [K, V]>[]) => [K, V] extends [UK, UV] ? any : never;

keyValueContext

undocumented

Definition

readonly keyValueContext: RMap.Context<UK>;

Overrides

Context.keyValueContext

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], BiMap<K, V>>;

typeTag

undocumented

Definition

get typeTag(): 'BiMap';

Overrides

Context.typeTag

valueKeyContext

undocumented

Definition

readonly valueKeyContext: RMap.Context<UV>;

Overrides

Context.valueKeyContext

Methods

builder

Returns an empty BiMap builder instance.

Definition

builder<K extends UK, V extends UV>(): BiMap.Builder<K, V>;

Type parameters

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

Overrides

BiMapFactory.builder

createBuilder

undocumented

Definition

createBuilder<K extends UK, V extends UV>(source?: BiMapNonEmptyImpl<K, V>): BiMapBuilder<K, V>;

Type parameters

NameConstraintsDescription
KUK
VUV

Parameters

NameTypeDescription
sourceBiMapNonEmptyImpl<K, V>

createNonEmptyImpl

undocumented

Definition

createNonEmptyImpl<K extends UK, V extends UV>(keyValueMap: RMap.NonEmpty<K, V>, valueKeyMap: RMap.NonEmpty<V, K>): BiMapNonEmptyImpl<K, V>;

Type parameters

NameConstraintsDescription
KUK
VUV

Parameters

NameTypeDescription
keyValueMapRMap.NonEmpty<K, V>
valueKeyMapRMap.NonEmpty<V, K>

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>(): BiMap<K, V>;

Type parameters

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

Overrides

BiMapFactory.empty

from

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

Definitions

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

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

Type parameters

NameConstraintsDescription
KUK
VUV

Parameters

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

Overrides

BiMapFactory.from

of

Returns an immutable BiMap, containing the given entries.

Definition

of<K extends UK, V extends UV>(...entries: ArrayNonEmpty<readonly [K, V]>): BiMap.NonEmpty<K, V>;

Type parameters

NameConstraintsDescription
KUK
VUV

Parameters

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

Overrides

BiMapFactory.of

reducer

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.

Definition

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

Type parameters

NameConstraintsDescription
KUK
VUV

Parameters

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

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

Overrides

BiMapFactory.reducer