Skip to main content

class HashSetContext<UT>

undocumented

Extends: ContextBase<UT,Tp>

Implements: HashSet.Context<UT>

Type parameters

NameDescription
UTundocumented

Properties

_empty

undocumented

Definition

readonly _empty: HashSet<any>;

Overrides

ContextBase._empty

_emptyBlock

undocumented

Definition

readonly _emptyBlock: HashSetBlock<any>;

_fixedElementType

undocumented

Definition

readonly _fixedElementType: any;

Overrides

Context._fixedElementTypeContextBase._fixedElementType

_types

undocumented

Definition

get _types(): Tp;

Overrides

Context._typesContextBase._types

blockCapacity

undocumented

Definition

readonly blockCapacity: number;

blockMask

undocumented

Definition

readonly blockMask: number;

blockSizeBits

undocumented

Definition

readonly blockSizeBits: number;

builder

undocumented

Definition

readonly builder: <T extends UT>() => HashSet.Builder<T>;

empty

undocumented

Definition

readonly empty: <T extends UT>() => WithElem<Tp, T>["normal"];

Overrides

ContextBase.empty

eq

undocumented

Definition

readonly eq: Eq<UT>;

Overrides

Context.eq

from

undocumented

Definition

readonly from: any;

Overrides

ContextBase.from

hasher

undocumented

Definition

readonly hasher: Hasher<UT>;

Overrides

Context.hasher

listContext

undocumented

Definition

readonly listContext: List.Context;

maxDepth

undocumented

Definition

readonly maxDepth: number;

of

undocumented

Definition

readonly of: <T extends UT>(values_0: T, ...values_1: T[]) => T extends UT ? WithElem<Tp, T>["nonEmpty"] : never;

Overrides

ContextBase.of

reducer

undocumented

Definition

readonly reducer: <T extends UT>(source?: StreamSource<T>) => Reducer<T, WithElem<Tp, T>["normal"]>;

Overrides

ContextBase.reducer

typeTag

undocumented

Definition

readonly typeTag = "HashSet";

Overrides

ContextBase.typeTagContext.typeTag

Methods

block

undocumented

Definition

block(entries: readonly UT[] |null, entrySets:SetEntrySet<UT>[] |null, size: number, level: number):HashSetBlock<UT>;

Parameters

NameTypeDescription
entriesreadonly UT[] | null
entrySetsSetEntrySet<UT>[] | null
sizenumber
levelnumber

builder

Returns an empty builder instance for this type of collection and context.

Definition

abstract builder<T extends UT>(): WithElem<Tp, T>['builder'];

Type parameters

NameConstraintsDescription
TUT
example
HashSet.builder<number>()     // => HashSet.Builder<number>

Overrides

Factory.builder, ContextBase.builder

collision

undocumented

Definition

collision(entries: List.NonEmpty<UT>): HashSetCollision<UT>;

Parameters

NameTypeDescription
entriesList.NonEmpty<UT>

createBuilder

undocumented

Definition

createBuilder<T extends UT>(source?: HashSet.NonEmpty<T>): HashSet.Builder<T>;

Type parameters

NameConstraintsDescription
TUT

Parameters

NameTypeDescription
sourceHashSet.NonEmpty<T>

empty

Returns the (singleton) empty instance of this type and context with given value type.

Definition

empty<T extends UT>(): WithElem<Tp, T>['normal'];

Type parameters

NameConstraintsDescription
TUT
example
HashSet.empty<number>()    // => HashSet<number>
HashSet.empty<string>() // => HashSet<string>

Overrides

Factory.empty

emptyBlock

undocumented

Definition

emptyBlock(): HashSetBlock<UT>;

from

Returns an immutable set of this collection type and context, containing the given values in 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

NameConstraintsDescription
TUT

Parameters

NameTypeDescription
sourcesArrayNonEmpty<StreamSource.NonEmpty<T>>an array of StreamSource instances containing values
example
HashSet.from([1, 2, 3], [4, 5])   // => HashSet.NonEmpty<number>

Overrides

Factory.from

getKeyIndex

undocumented

Definition

getKeyIndex(level: number, hash: number): number;

Parameters

NameTypeDescription
levelnumber
hashnumber

hash

undocumented

Definition

hash(value: UT): number;

Parameters

NameTypeDescription
valueUT

isHashSetBlock

undocumented

Definition

isHashSetBlock<T>(obj: SetEntrySet<T> | StreamSource<T>): obj is HashSetBlock<T>;

Type parameters

NameDescription
T

Parameters

NameTypeDescription
objSetEntrySet<T> | StreamSource<T>

isHashSetBlockBuilder

undocumented

Definition

isHashSetBlockBuilder<T>(obj: SetBlockBuilderEntry<T>): obj is HashSetBlockBuilder<T>;

Type parameters

NameDescription
T

Parameters

NameTypeDescription
objSetBlockBuilderEntry<T>

isHashSetCollision

undocumented

Definition

isHashSetCollision<T>(obj: SetEntrySet<T> | StreamSource<T>): obj is HashSetCollision<T>;

Type parameters

NameDescription
T

Parameters

NameTypeDescription
objSetEntrySet<T> | StreamSource<T>

isNonEmptyInstance

undocumented

Definition

isNonEmptyInstance(source: any): source is any;

Parameters

NameTypeDescription
sourceany

Overrides

ContextBase.isNonEmptyInstance

isValidValue

undocumented

Definition

isValidValue(value: unknown): value is UT;

Parameters

NameTypeDescription
valueunknown

Overrides

ContextBase.isValidValue, Context.isValidValue

of

Returns an immutable set of this type and context, containing the given values.

Definition

of<T extends UT>(...values: ArrayNonEmpty<T>): WithElem<Tp, T>['nonEmpty'];

Type parameters

NameConstraintsDescription
TUT

Parameters

NameTypeDescription
valuesArrayNonEmpty<T>a non-empty array of values
example
HashSet.of(1, 2, 3).toArray()   // => [1, 2, 3]

Overrides

Factory.of

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.

Definition

reducer<T extends UT>(source?: StreamSource<T>): Reducer<T, WithElem<Tp, T>['normal']>;

Type parameters

NameConstraintsDescription
TUT

Parameters

NameTypeDescription
sourceStreamSource<T>(optional) an initial source of elements to append to
example
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]
note

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

Overrides

Factory.reducer