class SortedSetContext<UT>
undocumented
Extends: ContextBase<UT,Tp>
Type parameters
| Name | Description |
|---|---|
| UT | undocumented |
Properties
_empty
undocumented
_empty_types
undocumented
_typesbuilder
undocumented
builderDefinition
readonly builder: <T extends UT>() => SortedSetBuilder<T>;
empty
undocumented
emptyfrom
undocumented
fromof
undocumented
ofreducer
undocumented
reducerDefinition
readonly reducer: <T extends UT>(source?: StreamSource<T>) => Reducer<T, WithElem<Tp, T>["normal"]>;
Overrides
typeTag
undocumented
typeTagMethods
builder
Returns an empty builder instance for this type of collection and context.
buildercreateBuilder
undocumented
createBuilderDefinition
createBuilder<T extends UT>(source?: SortedSet<T>): SortedSetBuilder<T>;
Type parameters
| Name | Constraints | Description |
|---|---|---|
| T | UT |
Parameters
| Name | Type | Description |
|---|---|---|
source | SortedSet<T> |
empty
Returns the (singleton) empty instance of this type and context with given value type.
emptyfindIndex
undocumented
findIndexfrom
Returns an immutable set of this collection type and context, containing the given values in source.
fromsource.Definitions
from<T extends UT>(...sources: ArrayNonEmpty<StreamSource.NonEmpty<T>>): WithElem<Tp, T>['nonEmpty'];
from<T extends UT>(...sources: ArrayNonEmpty<StreamSource<T>>): WithElem<Tp, T>['normal'];
Type parameters
| Name | Constraints | Description |
|---|---|---|
| T | UT |
Parameters
| Name | Type | Description |
|---|---|---|
sources | ArrayNonEmpty<StreamSource.NonEmpty<T>> | an array of StreamSource instances containing values |
HashSet.from([1, 2, 3], [4, 5]) // => HashSet.NonEmpty<number>
Overrides
inner
undocumented
innerDefinition
inner(entries: readonly UT[], children: readonly SortedSetNode<UT>[], size: number): SortedSetInner<UT>;
Parameters
| Name | Type | Description |
|---|---|---|
entries | readonly UT[] | |
children | readonly SortedSetNode<UT>[] | |
size | number |
isNonEmptyInstance
undocumented
isNonEmptyInstanceisSortedSetEmpty
undocumented
isSortedSetEmptyisSortedSetInner
undocumented
isSortedSetInnerDefinition
isSortedSetInner<T>(obj: any): obj is SortedSetInner<T>;
Type parameters
| Name | Description |
|---|---|
| T |
Parameters
| Name | Type | Description |
|---|---|---|
obj | any |
isSortedSetLeaf
undocumented
isSortedSetLeafDefinition
isSortedSetLeaf<T>(obj: any): obj is SortedSetLeaf<T>;
Type parameters
| Name | Description |
|---|---|
| T |
Parameters
| Name | Type | Description |
|---|---|---|
obj | any |
isSortedSetNode
undocumented
isSortedSetNodeDefinition
isSortedSetNode<T>(obj: any): obj is SortedSetNode<T>;
Type parameters
| Name | Description |
|---|---|
| T |
Parameters
| Name | Type | Description |
|---|---|---|
obj | any |
isValidValue
undocumented
isValidValueleaf
undocumented
leafDefinition
leaf(entries: readonly UT[]): SortedSetLeaf<UT>;
Parameters
| Name | Type | Description |
|---|---|---|
entries | readonly UT[] |
of
Returns an immutable set of this type and context, containing the given values.
ofvalues.Definition
of<T extends UT>(...values: ArrayNonEmpty<T>): WithElem<Tp, T>['nonEmpty'];
Type parameters
| Name | Constraints | Description |
|---|---|---|
| T | UT |
Parameters
| Name | Type | Description |
|---|---|---|
values | ArrayNonEmpty<T> | a non-empty array of values |
HashSet.of(1, 2, 3).toArray() // => [1, 2, 3]
Overrides
reducer
Returns a Reducer that appends received items to an RSet and returns the RSet as a result. When a source is given, the reducer will first create an RSet from the source, and then append elements to it.
reducerReducer that appends received items to an RSet and returns the RSet as a result. When a source is given, the reducer will first create an RSet from the source, and then append elements to it.Definition
reducer<T extends UT>(source?: StreamSource<T>): Reducer<T, WithElem<Tp, T>['normal']>;
Type parameters
| Name | Constraints | Description |
|---|---|---|
| T | UT |
Parameters
| Name | Type | Description |
|---|---|---|
source | StreamSource<T> | (optional) an initial source of elements to append to |
const someList = SortedSet.of(1, 2, 3);
const result = Stream.range({ start: 20, amount: 5 }).reduce(SortedSet.reducer(someList))
result.toArray() // => [1, 2, 3, 20, 21, 22, 23, 24]
uses an RSet builder under the hood. If the given source is a RSet in the same context, it will directly call .toBuilder().