class MultiMapContext<UK,UV,N,Tp>
undocumented
Implements: MultiMapBase.Context<UK,UV,Tp>
Type parameters
Name | Constraints | Default | Description |
---|---|---|---|
UK | undocumented | ||
UV | undocumented | ||
N | string | undocumented | |
Tp | ContextImplTypes | ContextImplTypes | undocumented |
Properties
_empty
undocumented
_empty
Definition
readonly _empty: Readonly<
WithKeyValue
<Tp, UK, UV>["normal"]>;
builder
undocumented
builder
Definition
readonly builder: <K extends UK, V extends UV>() =>
WithKeyValue
<Tp, K, V>["builder"];
empty
undocumented
empty
Definition
readonly empty: <K extends UK, V extends UV>() =>
WithKeyValue
<Tp, K, V>["normal"];
keyMapContext
undocumented
keyMapContext
keyMapValuesContext
undocumented
keyMapValuesContext
of
undocumented
of
Definition
readonly of: <K extends UK, V extends UV>(entries_0: readonly [K, V], ...entries_1: (readonly [K, V])[]) => [K, V] extends [UK, UV] ?
WithKeyValue
<Tp, K, V>["nonEmpty"] : never;
reducer
undocumented
reducer
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
typeTag
Methods
builder
Returns an empty builder instance for this type of collection and context.
builder
Definition
builder<K extends UK, V extends UV>():
WithKeyValue
<Tp, K, V>['builder'];
Type parameters
Name | Constraints | Description |
---|---|---|
K | UK | |
V | UV |
HashMultiMapHashValue.builder<number, string>() // => HashMultiMapHashValue.Builder<number, string>
Overrides
createBuilder
undocumented
createBuilder
Definition
createBuilder<K, V>(source?:
MultiMap.NonEmpty
<K, V>):
WithKeyValue
<Tp, K, V>['builder'];
Type parameters
Name | Description |
---|---|
K | |
V |
Parameters
Name | Type | Description |
---|---|---|
source | MultiMap.NonEmpty <K, V> |
createNonEmpty
undocumented
createNonEmpty
Definition
createNonEmpty<K extends UK, V extends UV>(keyMap:
WithKeyValue
<Tp, K, V>['keyMapNonEmpty'], size: number):
WithKeyValue
<Tp, K, V>['nonEmpty'];
Type parameters
Name | Constraints | Description |
---|---|---|
K | UK | |
V | UV |
Parameters
Name | Type | Description |
---|---|---|
keyMap | WithKeyValue <Tp, K, V>['keyMapNonEmpty'] | |
size | number |
empty
Returns the (singleton) empty instance of this type and context with given key and value types.
empty
Definition
empty<K extends UK, V extends UV>():
WithKeyValue
<Tp, K, V>['normal'];
Type parameters
Name | Constraints | Description |
---|---|---|
K | UK | |
V | UV |
HashMultiMapHashValue.empty<number, string>() // => HashMultiMapHashValue<number, string>
HashMultiMapHashValue.empty<string, boolean>() // => HashMultiMapHashValue<string, boolean>
Overrides
from
Returns an immutable multimap of this type and context, containing the entries in the given source
StreamSource
.
from
source
StreamSource
.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
Name | Constraints | Description |
---|---|---|
K | UK | |
V | UV |
Parameters
Name | Type | Description |
---|---|---|
sources | ArrayNonEmpty < StreamSource.NonEmpty <readonly [K, V]>> | an array of StreamSource instances containing key-value entries |
HashMultiMapHashValue.from([[1, 'a'], [2, 'b']]) // => HashMultiMapHashValue.NonEmpty<number, string>
Overrides
isNonEmptyInstance
undocumented
isNonEmptyInstance
Definition
isNonEmptyInstance<K, V>(source: any): source is
WithKeyValue
<Tp, K, V>['nonEmpty'];
Type parameters
Name | Description |
---|---|
K | |
V |
Parameters
Name | Type | Description |
---|---|---|
source | any |
of
Returns an immutable multimap of this collection type and context, containing the given entries
.
of
entries
.Definition
of<K extends UK, V extends UV>(...entries:
ArrayNonEmpty
<readonly [K, V]>):
WithKeyValue
<Tp, K, V>['nonEmpty'];
Type parameters
Name | Constraints | Description |
---|---|---|
K | UK | |
V | UV |
Parameters
Name | Type | Description |
---|---|---|
entries | ArrayNonEmpty <readonly [K, V]> | a non-empty array of key-value entries |
HashMultiMapHashValue.of([1, 'a'], [2, 'b'], [1, 'c']) // => HashMap.NonEmpty<number, string>
Overrides
reducer
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.
reducer
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.Definition
reducer<K extends UK, V extends UV>(source?:
StreamSource
<readonly [K, V]>): Reducer<readonly [K, V],
WithKeyValue
<Tp, K, V>['normal']>;
Type parameters
Name | Constraints | Description |
---|---|---|
K | UK | |
V | UV |
Parameters
Name | Type | Description |
---|---|---|
source | StreamSource <readonly [K, V]> | (optional) an initial source of tuples to add to |
const someSource: [number, string][] = [1, 'a'], [2, 'b'];
const result = Stream.of([1, 'c'], [3, 'a']).reduce(SortedMultiMap.reducer(someSource))
result.toArray() // => [[1, 'a'], [1, 'c'], [2, 'b'], [3, 'a']]
uses a builder under the hood. If the given source
is a BiMap in the same context, it will directly call .toBuilder()
.