class HashSetContext<UT>
undocumented
Extends: ContextBase<UT,Tp>
Implements: HashSet.Context<UT>
Type parameters
Name | Description |
---|---|
UT | undocumented |
Properties
_empty
undocumented
_empty
_emptyBlock
undocumented
_emptyBlock
Definition
readonly _emptyBlock:
HashSetBlock
<any>;
_types
undocumented
_types
builder
undocumented
builder
Definition
readonly builder: <T extends UT>() =>
HashSet.Builder
<T>;
empty
undocumented
empty
eq
undocumented
eq
from
undocumented
from
hasher
undocumented
hasher
listContext
undocumented
listContext
Definition
readonly listContext:
List.Context
;
of
undocumented
of
reducer
undocumented
reducer
Definition
readonly reducer: <T extends UT>(source?:
StreamSource
<T>) => Reducer<T,
WithElem
<Tp, T>["normal"]>;
Overrides
typeTag
undocumented
typeTag
Methods
block
undocumented
block
Definition
block(entries: readonly UT[]
|
null, entrySets:
SetEntrySet
<UT>[]
|
null, size: number, level: number):
HashSetBlock
<UT>;
Parameters
Name | Type | Description |
---|---|---|
entries | readonly UT[] | null | |
entrySets | SetEntrySet <UT>[] | null | |
size | number | |
level | number |
builder
Returns an empty builder instance for this type of collection and context.
builder
collision
undocumented
collision
Definition
collision(entries:
List.NonEmpty
<UT>):
HashSetCollision
<UT>;
Parameters
Name | Type | Description |
---|---|---|
entries | List.NonEmpty <UT> |
createBuilder
undocumented
createBuilder
Definition
createBuilder<T extends UT>(source?:
HashSet.NonEmpty
<T>):
HashSet.Builder
<T>;
Type parameters
Name | Constraints | Description |
---|---|---|
T | UT |
Parameters
Name | Type | Description |
---|---|---|
source | HashSet.NonEmpty <T> |
empty
Returns the (singleton) empty instance of this type and context with given value type.
empty
emptyBlock
undocumented
emptyBlock
Definition
emptyBlock():
HashSetBlock
<UT>;
from
Returns an immutable set of this collection type and context, containing the given values in source
.
from
source
.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
getKeyIndex
undocumented
getKeyIndex
isHashSetBlock
undocumented
isHashSetBlock
Definition
isHashSetBlock<T>(obj:
SetEntrySet
<T>
|
StreamSource
<T>): obj is
HashSetBlock
<T>;
Type parameters
Name | Description |
---|---|
T |
Parameters
Name | Type | Description |
---|---|---|
obj | SetEntrySet <T> | StreamSource <T> |
isHashSetBlockBuilder
undocumented
isHashSetBlockBuilder
Definition
isHashSetBlockBuilder<T>(obj:
SetBlockBuilderEntry
<T>): obj is
HashSetBlockBuilder
<T>;
Type parameters
Name | Description |
---|---|
T |
Parameters
Name | Type | Description |
---|---|---|
obj | SetBlockBuilderEntry <T> |
isHashSetCollision
undocumented
isHashSetCollision
Definition
isHashSetCollision<T>(obj:
SetEntrySet
<T>
|
StreamSource
<T>): obj is
HashSetCollision
<T>;
Type parameters
Name | Description |
---|---|
T |
Parameters
Name | Type | Description |
---|---|---|
obj | SetEntrySet <T> | StreamSource <T> |
isNonEmptyInstance
undocumented
isNonEmptyInstance
isValidValue
undocumented
isValidValue
of
Returns an immutable set of this type and context, containing the given values
.
of
values
.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.
reducer
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.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()
.