interface SortedTableHashColumnCreators
undocumented
Extends: TableBase.Factory<Tp,UR,UC>
Methods
builder
Returns an empty builder instance for this type of collection and context.
builder
createContext
Returns a new SortedTableHashColumn context instance based on the given options
.
createContext
options
.Definition
createContext<UR, UC>(options?: {
rowContext?:
SortedMap.Context
<UR>;
columnContext?:
HashMap.Context
<UC>;
}):
SortedTableHashColumn.Context
<UR, UC>;
Type parameters
Name | Description |
---|---|
UR | the upper row key type for which the context can create instances |
UC | the upper column key type for which the context can create instances |
Parameters
Name | Type | Description |
---|---|---|
options | { rowContext?: SortedMap.Context <UR>; columnContext?: HashMap.Context <UC>; } | (optional) an object containing the following properties: - rowContext: (optional) the map context to use to map row keys to columns - columnContext: (optional) the map context to use to map column keys to values |
defaultContext
Returns the default context for SortedTableHashColumns.
defaultContext
Definition
defaultContext<UR, UC>():
SortedTableHashColumn.Context
<UR, UC>;
Type parameters
Name | Description |
---|---|
UR | the upper row key type for which the context can create instances |
UC | the upper column key type for which the context can create instances |
empty
Returns the (singleton) empty instance of this type and context with given key and value types.
empty
Definition
empty<R extends UR, C extends UC, V>():
WithRow
<Tp, R, C, V>['normal'];
Type parameters
Name | Constraints | Description |
---|---|---|
R | UR | |
C | UC | |
V |
HashTableHashColumn.empty<number, string, boolean>() // => HashTableHashColumn<number, string, boolean>
HashTableHashColumn.empty<string, boolean, number>() // => HashTableHashColumn<string, boolean, number>
Overrides
from
Returns an immutable table of this type and context, containing the entries in the given sources
StreamSource
instances.
from
sources
StreamSource
instances.Definitions
from<R extends UR, C extends UC, V>(...sources:
ArrayNonEmpty
<
StreamSource.NonEmpty
<readonly [R, C, V]>>):
WithRow
<Tp, R, C, V>['nonEmpty'];
from<R extends UR, C extends UC, V>(...sources:
ArrayNonEmpty
<
StreamSource
<readonly [R, C, V]>>):
WithRow
<Tp, R, C, V>['normal'];
Type parameters
Name | Constraints | Description |
---|---|---|
R | UR | |
C | UC | |
V |
Parameters
Name | Type | Description |
---|---|---|
sources | ArrayNonEmpty < StreamSource.NonEmpty <readonly [R, C, V]>> | an array of StreamSource instances containing row-column-value entries |
HashTableHashColumn.from([[1, 2, 3], [1, 4, 5]]) // => HashTableHashColumn.NonEmpty<number, number, number>
Overrides
of
Returns an immutable multimap of this collection type and context, containing the given entries
.
of
entries
.Definition
of<R extends UR, C extends UC, V>(...entries:
ArrayNonEmpty
<readonly [R, C, V]>):
WithRow
<Tp, R, C, V>['nonEmpty'];
Type parameters
Name | Constraints | Description |
---|---|---|
R | UR | |
C | UC | |
V |
Parameters
Name | Type | Description |
---|---|---|
entries | ArrayNonEmpty <readonly [R, C, V]> | a non-empty array of row-column-value entries |
HashTableHashColumn.of([1, 2, 3], [1, 4, 5]) // => HashTableHashColumn.NonEmpty<number, number, number>
Overrides
reducer
Returns a Reducer
that adds received tuples to a Table and returns the Table as a result. When a source
is given, the reducer will first create a Table from the source, and then add tuples to it.
reducer
Reducer
that adds received tuples to a Table and returns the Table as a result. When a source
is given, the reducer will first create a Table from the source, and then add tuples to it.Definition
reducer<R extends UR, C extends UC, V>(source?:
StreamSource
<readonly [R, C, V]>): Reducer<readonly [R, C, V],
WithRow
<Tp, R, C, V>['normal']>;
Type parameters
Name | Constraints | Description |
---|---|---|
R | UR | |
C | UC | |
V |
Parameters
Name | Type | Description |
---|---|---|
source | StreamSource <readonly [R, C, V]> | (optional) an initial source of tuples to add to |
const someSource = Table.of([1, 'a', true], [2, 'b', false]);
const result = Stream.of([1, 'c', true], [3, 'a', false]).reduce(Table.reducer(someSource))
result.toArray() // => [[1, 'c'], [2, 'b'], [3, 'a']]
uses a builder under the hood. If the given source
is a Table in the same context, it will directly call .toBuilder()
.