Skip to main content

class SortedSetEmpty<T>

undocumented

Implements: SortedSet<T>

Type parameters

NameDefaultDescription
Tanyundocumented

Properties

_NonEmptyType

undocumented

Definition

_NonEmptyType: SortedSet.NonEmpty<T>;

context

undocumented

Definition

readonly context: SortedSetContext<T>;

Methods

add

undocumented

Definition

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

Parameters

NameTypeDescription
valueT

addAll

undocumented

Definition

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

Parameters

NameTypeDescription
valuesStreamSource<T>

difference

undocumented

Definition

difference(): SortedSet<T>;

drop

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

Definition

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

Parameters

NameTypeDescription
amountnumberthe amount of elements to keep
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

getAtIndex

Returns the value at the given index of the value sort order of the SortedSet, or a fallback value (default: undefined) if the index is out of bounds.

Definitions

getAtIndex(index: number): T | undefined;

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

Parameters

NameTypeDescription
indexnumberthe index in the key sort order
note

negative index values will retrieve the values from the end of the sort order, e.g. -1 is the last value

example
const m = SortedSet.of('b', 'd', 'a', 'c').asNormal();
console.log(m.getAtIndex(1))
// => 'b'
console.log(m.getAtIndex(-1))
// => 'd'
console.log(m.getAtIndex(10))
// => undefined
console.log(m.getAtIndex(10, 'q'))
// => 'q'

Overrides

SortedSet.getAtIndex

has

undocumented

Definition

has(): false;

intersect

undocumented

Definition

intersect(): SortedSet<T>;

max

Returns the maximum value of the SortedSet, or a fallback value (default: undefined) if the SortedSet is empty.

Definitions

max(): T | undefined;

max<O>(otherwise: OptLazy<O>): T | O;

example
const m = SortedSet.of('b', 'd', 'a', 'c').asNormal();
console.log(m.max())
// => 'a'
console.log(m.max('q'))
// => 'a'
console.log(SortedSet.empty().max())
// => undefined
console.log(SortedSet.empty().max('q'))
// => 'q'

Overrides

SortedSet.max

min

Returns the minimum value of the SortedSet, or a fallback value (default: undefined) if the SortedSet is empty.

Definitions

min(): T | undefined;

min<O>(otherwise: OptLazy<O>): T | O;

example
const m = SortedSet.of('b', 'd', 'a', 'c').asNormal();
console.log(m.min())
// => 'a'
console.log(m.min('q'))
// => 'a'
console.log(SortedSet.empty().min())
// => undefined
console.log(SortedSet.empty().min('q'))
// => 'q'

Overrides

SortedSet.min

remove

undocumented

Definition

remove(): this;

removeAll

undocumented

Definition

removeAll(): this;

slice

undocumented

Definition

slice(): this;

Overrides

SortedSet.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
rangeIndexRangean IndexRange defining the sort order indices to include.
example
const m = SortedSet.of('b', 'd', 'a', 'c').asNormal();
console.log(m.sliceIndex({ start: 1, amount: 2 }).toArray())
// => ['b', 'c']

Overrides

SortedSet.sliceIndex

stream

undocumented

Definition

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

Parameters

NameTypeDescription
options{
    reversed?: boolean;
  }

Overrides

SortedSet.stream

streamRange

undocumented

Definition

streamRange(): Stream<T>;

Overrides

SortedSet.streamRange

streamSliceIndex

undocumented

Definition

streamSliceIndex(): Stream<T>;

Overrides

SortedSet.streamSliceIndex

symDifference

undocumented

Definition

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

Parameters

NameTypeDescription
otherStreamSource<T>

take

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

Definition

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

Parameters

NameTypeDescription
amountnumberthe amount of elements to keep
note

a negative amount takes 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.take(2).toArray())
// => ['a', 'b']
console.log(m.take(-2).toArray())
// => ['c', 'd']

Overrides

SortedSet.take

toBuilder

undocumented

Definition

toBuilder(): SortedSet.Builder<T>;

toJSON

undocumented

Definition

toJSON(): ToJSON<T[]>;

toString

undocumented

Definition

toString(): string;

union

undocumented

Definition

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

Parameters

NameTypeDescription
otherStreamSource<T>