Skip to main content

class SortedSetInner<T>

undocumented

Extends: SortedSetNode<T>

Type parameters

NameDescription
Tundocumented

Properties

_NonEmptyType

undocumented

Definition

_NonEmptyType: SortedSetNode<T>;

Overrides

SortedSetNode._NonEmptyType

children

undocumented

Definition

children: readonly SortedSetNode<T>[];

context

undocumented

Definition

readonly context: SortedSetContext<T>;

Overrides

SortedSetNode.context

entries

undocumented

Definition

entries: readonly T[];

isEmpty

Returns false since this collection is known to be non-empty

Definition

readonly isEmpty: false;

example
HashSet.of(1, 2, 3).isEmpty   // => false

Overrides

VariantSetBase.isEmptyNonEmpty.isEmpty

mutateChildren

undocumented

Definition

get mutateChildren(): SortedSetNode<T>[];

size

undocumented

Definition

size: number;

Overrides

SortedSetNode.size

Methods

[Symbol.iterator]

Returns a FastIterator instance used to iterate over the values of this Iterable.

Definition

[Symbol.iterator](): FastIterator<T>;

Overrides

FastIterable.[Symbol.iterator]

add

Returns the collection with given value added.

Definition

add(value: T): SortedSet.NonEmpty<T>;

Parameters

NameTypeDescription
valueT
example
HashSet.of(1, 2, 3).add(10).toArray()   // => [1, 2, 3, 10]

Overrides

NonEmpty.add, SortedSetNode.add

addAll

Returns the collection with the values in given values StreamSource added.

Definition

addAll(values: StreamSource<T>): SortedSet.NonEmpty<T>;

Parameters

NameTypeDescription
valuesStreamSource<T>
example
HashSet.of(1, 2, 3).addAll(10, 11).toArray()   // => [1, 2, 3, 10, 11]

Overrides

NonEmpty.addAll, SortedSetNode.addAll

addInternal

undocumented

Definition

addInternal(value: T): SortedSetInner<T>;

Parameters

NameTypeDescription
valueT

Overrides

SortedSetNode.addInternal

asNormal

undocumented

Definition

asNormal(): this;

Overrides

SortedSetNode.asNormal

assumeNonEmpty

Returns a self reference since this collection is known to be non-empty.

Definition

assumeNonEmpty(): this;

example
const m = HashSet.of(1, 2, 3);
m === m.assumeNonEmpty() // => true

Overrides

VariantSetBase.assumeNonEmpty, NonEmpty.assumeNonEmpty

copy

undocumented

Definition

copy(entries?: readonly T[], children?: readonly SortedSetNode<T>[], size?: number): SortedSetInner<T>;

Parameters

NameTypeDescription
entriesreadonly T[]
childrenreadonly SortedSetNode<T>[]
sizenumber

deleteMax

undocumented

Definition

deleteMax(): [T, SortedSetInner<T>];

deleteMin

undocumented

Definition

deleteMin(): [T, SortedSetInner<T>];

difference

undocumented

Definition

difference(other: StreamSource<T>): SortedSet<T>;

Parameters

NameTypeDescription
otherStreamSource<T>

Overrides

SortedSetNode.difference

drop

Returns a SortedSet containing all but the the first amount of value of this SortedSet.

Definition

drop(amount: number): SortedSet<T>;

Parameters

NameTypeDescription
amountnumber
note

a negative amount drops the last values instead of the first, e.g. -2 is the last 2 elements

example
const m = SortedSet.of('b', 'd', 'a', 'c').asNormal();
console.log(m.drop(2).toArray())
// => ['c', 'd']
console.log(m.drop(-2).toArray())
// => ['a', 'b']

Overrides

SortedSet.drop, SortedSetNode.drop

dropInternal

undocumented

Definition

dropInternal(amount: number): SortedSetNode<T>;

Parameters

NameTypeDescription
amountnumber

filter

undocumented

Definition

filter(pred: (value: T, index: number, halt: () => void) => boolean, options?: {
    negate?: boolean | undefined;
  }): any;

Parameters

NameTypeDescription
pred(value: T, index: number, halt: () => void) => boolean
options{
    negate?: boolean | undefined;
  }

Overrides

SortedSetNode.filter

forEach

undocumented

Definition

forEach(f: (value: T, index: number, halt: () => void) => void, options?: {
    state?: TraverseState;
  }): void;

Parameters

NameTypeDescription
f(value: T, index: number, halt: () => void) => void
options{
    state?: TraverseState;
  }

Overrides

SortedSetNode.forEach

getAtIndex

undocumented

Definition

getAtIndex<O>(index: number, otherwise?: OptLazy<O>): T | O;

Type parameters

NameDescription
O

Parameters

NameTypeDescription
indexnumber
otherwiseOptLazy<O>

Overrides

SortedSet.getAtIndex

getInsertIndexOf

undocumented

Definition

getInsertIndexOf(value: T): number;

Parameters

NameTypeDescription
valueT

Overrides

SortedSetNode.getInsertIndexOf

getSliceRange

undocumented

Definition

getSliceRange(range: Range<T>): {
    startIndex: number;
    endIndex: number;
  };

Parameters

NameTypeDescription
rangeRange<T>

Overrides

SortedSetNode.getSliceRange

has

undocumented

Definition

has<U>(value: RelatedTo<T, U>): boolean;

Type parameters

NameDescription
U

Parameters

NameTypeDescription
valueRelatedTo<T, U>

Overrides

SortedSetNode.has

intersect

undocumented

Definition

intersect(other: StreamSource<T>): SortedSet<T>;

Parameters

NameTypeDescription
otherStreamSource<T>

Overrides

SortedSetNode.intersect

max

undocumented

Definition

max(): T;

Overrides

SortedSetNode.max

min

undocumented

Definition

min(): T;

Overrides

SortedSetNode.min

mutateGetFromLeft

undocumented

Definition

mutateGetFromLeft(left: SortedSetInner<T>, toMe: T): [T, SortedSetInner<T>];

Parameters

NameTypeDescription
leftSortedSetInner<T>
toMeT

mutateGetFromRight

undocumented

Definition

mutateGetFromRight(right: SortedSetInner<T>, toMe: T): [T, SortedSetInner<T>];

Parameters

NameTypeDescription
rightSortedSetInner<T>
toMeT

mutateGiveToLeft

undocumented

Definition

mutateGiveToLeft(left: SortedSetInner<T>, toLeft: T): [T, SortedSetInner<T>];

Parameters

NameTypeDescription
leftSortedSetInner<T>
toLeftT

mutateGiveToRight

undocumented

Definition

mutateGiveToRight(right: SortedSetInner<T>, toRight: T): [T, SortedSetInner<T>];

Parameters

NameTypeDescription
rightSortedSetInner<T>
toRightT

mutateJoinLeft

undocumented

Definition

mutateJoinLeft(left: SortedSetInner<T>, entry: T): void;

Parameters

NameTypeDescription
leftSortedSetInner<T>
entryT

mutateJoinRight

undocumented

Definition

mutateJoinRight(right: SortedSetInner<T>, entry: T): void;

Parameters

NameTypeDescription
rightSortedSetInner<T>
entryT

mutateSplitRight

undocumented

Definition

mutateSplitRight(index?: number): [T, SortedSetInner<T>];

Parameters

NameTypeDescription
indexnumber

nonEmpty

Returns true since this collection is know to be non-empty

Definition

nonEmpty(): this is WithElem<Tp, T>['nonEmpty'];

example
HashSet.of(1, 2, 3).nonEmpty()   // => true

Overrides

VariantSetBase.nonEmpty, NonEmpty.nonEmpty

normalize

undocumented

Definition

normalize(): SortedSet<T>;

Overrides

SortedSetNode.normalize

normalizeDownsizeChild

undocumented

Definition

normalizeDownsizeChild(childIndex: number, newChild: SortedSetNode<T>, newSize: number): SortedSetInner<T>;

Parameters

NameTypeDescription
childIndexnumber
newChildSortedSetNode<T>
newSizenumber

normalizeIncreaseChild

undocumented

Definition

normalizeIncreaseChild(childIndex: number, newChild: SortedSetNode<T>, newSize: number): SortedSetInner<T>;

Parameters

NameTypeDescription
childIndexnumber
newChildSortedSetNode<T>
newSizenumber

remove

undocumented

Definition

remove<U>(value: RelatedTo<T, U>): SortedSet<T>;

Type parameters

NameDescription
U

Parameters

NameTypeDescription
valueRelatedTo<T, U>

Overrides

SortedSetNode.remove

removeAll

undocumented

Definition

removeAll<U>(values: StreamSource<RelatedTo<T, U>>): SortedSet<T>;

Type parameters

NameDescription
U

Parameters

NameTypeDescription
valuesStreamSource<RelatedTo<T, U>>

Overrides

SortedSetNode.removeAll

removeInternal

undocumented

Definition

removeInternal(value: T): SortedSetNode<T>;

Parameters

NameTypeDescription
valueT

Overrides

SortedSetNode.removeInternal

slice

Returns a SortedSet containing only those values that are within the given keyRange.

Definition

slice(range: Range<T>): SortedSet<T>;

Parameters

NameTypeDescription
rangeRange<T>
example
const m = SortedSet.of('b', 'd', 'a', 'c').asNormal();
console.log(m.slice({ start: 'b', end: 'c' }).toArray())
// => ['b', 'c']

Overrides

SortedSet.slice, SortedSetNode.slice

sliceIndex

Returns a SortedSet containing only those values that are within the given range index range of the value sort order.

Definition

sliceIndex(range: IndexRange): SortedSet<T>;

Parameters

NameTypeDescription
rangeIndexRange
example
const m = SortedSet.of('b', 'd', 'a', 'c').asNormal();
console.log(m.sliceIndex({ start: 1, amount: 2 }).toArray())
// => ['b', 'c']

Overrides

SortedSet.sliceIndex, SortedSetNode.sliceIndex

stream

undocumented

Definition

stream(options?: {
    reversed?: boolean;
  }): Stream.NonEmpty<T>;

Parameters

NameTypeDescription
options{
    reversed?: boolean;
  }

Overrides

SortedSetNode.stream

streamRange

Returns a Stream of sorted values of this collection within the given keyRange.

Definition

streamRange(range: Range<T>, options?: {
    reversed?: boolean;
  }): Stream<T>;

Parameters

NameTypeDescription
rangeRange<T>
options{
    reversed?: boolean;
  }
example
const m = SortedSet.of('b', 'd', 'a', 'c');
console.log(m.streamRange({ start: 'b', end: 'c' }).toArray())
// => ['b', 'c']

Overrides

SortedSet.streamRange, SortedSetNode.streamRange

streamSliceIndex

undocumented

Definition

streamSliceIndex(range: IndexRange, options?: {
    reversed?: boolean;
  }): Stream<T>;

Parameters

NameTypeDescription
rangeIndexRange
options{
    reversed?: boolean;
  }

Overrides

SortedSetNode.streamSliceIndex

symDifference

Returns a collection of the values that are either in this collection or in the other StreamSource, but not in both.

Definition

symDifference(other: StreamSource<T>): SortedSet<T>;

Parameters

NameTypeDescription
otherStreamSource<T>
example
HashSet.of(1, 2, 3).symDifference([2, 4]).toArray()
// => [1, 3, 4]

Overrides

RSetBase.symDifference, SortedSetNode.symDifference

take

undocumented

Definition

take(amount: number): SortedSet<T> | any;

Parameters

NameTypeDescription
amountnumber

Overrides

NonEmpty.take, SortedSetNode.take

takeInternal

undocumented

Definition

takeInternal(amount: number): SortedSetNode<T>;

Parameters

NameTypeDescription
amountnumber

toArray

undocumented

Definition

toArray(): ArrayNonEmpty<T>;

Overrides

SortedSetNode.toArray

toBuilder

Returns a builder object containing the values of this collection.

Definition

toBuilder(): SortedSet.Builder<T>;

example
const builder: HashSet.Builder<number> = HashSet.of(1, 2, 3).toBuilder()

Overrides

RSetBase.toBuilder, SortedSetNode.toBuilder

toJSON

undocumented

Definition

toJSON(): ToJSON<T[]>;

Overrides

SortedSetNode.toJSON

toString

undocumented

Definition

toString(): string;

Overrides

SortedSetNode.toString

union

Returns a collection containing all values from this collection and all values of given other StreamSource.

Definition

union(other: StreamSource<T>): SortedSet<T> | any;

Parameters

NameTypeDescription
otherStreamSource<T>
example
HashSet.of(1, 2, 3).union(HashSet.of(2, 4, 6)).toArray()
// => [1, 2, 3, 4, 6]

Overrides

NonEmpty.union, SortedSetNode.union