Skip to main content

abstract class SortedMapNode<K,V>

undocumented

Implements: SortedMap.NonEmpty<K,V>

Extended by: SortedMapInner<K,V>, SortedMapLeaf<K,V>

Type parameters

NameDescription
Kundocumented
Vundocumented

Properties

_NonEmptyType

undocumented

Definition

_NonEmptyType: SortedMap.NonEmpty<K, V>;

context

undocumented

Definition

abstract get context(): SortedMapContext<K>;

Overrides

RMapBase.context

isEmpty

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

Definition

readonly isEmpty: false;

example
HashMap.of([1, 1], [2, 2]).isEmpty   // => false

Overrides

VariantMapBase.isEmptyNonEmpty.isEmpty

size

undocumented

Definition

abstract get size(): number;

Overrides

VariantMapBase.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]

addEntries

undocumented

Definition

addEntries(entries: StreamSource<readonly [K, V]>): SortedMap.NonEmpty<K, V>;

Parameters

NameTypeDescription
entriesStreamSource<readonly [K, V]>

Overrides

NonEmpty.addEntries

addEntry

undocumented

Definition

addEntry(entry: readonly [K, V]): SortedMap.NonEmpty<K, V>;

Parameters

NameTypeDescription
entryreadonly [K, V]

Overrides

RMapBase.addEntry

addInternal

undocumented

Definition

abstract addInternal(entry: readonly [K, V], hash?: number): SortedMapNode<K, V>;

Parameters

NameTypeDescription
entryreadonly [K, V]
hashnumber

asNormal

undocumented

Definition

asNormal(): this;

Overrides

NonEmpty.asNormal

assumeNonEmpty

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

Definition

assumeNonEmpty(): this;

example
const m = HashMap.of([1, 1], [2, 2]);
m === m.assumeNonEmpty() // => true

Overrides

VariantMapBase.assumeNonEmpty, NonEmpty.assumeNonEmpty

drop

undocumented

Definition

drop(amount: number): SortedMap<K, V>;

Parameters

NameTypeDescription
amountnumber

Overrides

SortedMap.drop

filter

undocumented

Definition

filter(pred: (entry: readonly [K, V], index: number, halt: () => void) => boolean, options?: {
    negate?: boolean;
  }): SortedMap<K, V>;

Parameters

NameTypeDescription
pred(entry: readonly [K, V], index: number, halt: () => void) => boolean
options{
    negate?: boolean;
  }

Overrides

VariantMapBase.filter

forEach

undocumented

Definition

abstract forEach(f: (entry: readonly [K, V], index: number, halt: () => void) => void, options?: {
    state?: TraverseState;
  }): void;

Parameters

NameTypeDescription
f(entry: readonly [K, V], index: number, halt: () => void) => void
options{
    state?: TraverseState;
  }

Overrides

VariantMapBase.forEach

get

undocumented

Definition

abstract get<U, O>(key: RelatedTo<K, U>, otherwise?: OptLazy<O>): V | O;

Type parameters

NameDescription
U
O

Parameters

NameTypeDescription
keyRelatedTo<K, U>
otherwiseOptLazy<O>

Overrides

VariantMapBase.get

getAtIndex

Returns the entry with its key at the given index of the key sort order of the SortedMap, or a fallback value (default: undefined) if the index is out of bounds.

Definitions

getAtIndex(index: number): readonly [K, V] | undefined;

getAtIndex<O>(index: number, otherwise: OptLazy<O>): readonly [K, V] | 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 = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.getAtIndex(1))
// => ['b', 2]
console.log(m.getAtIndex(-1))
// => ['d', 4]
console.log(m.getAtIndex(10))
// => undefined
console.log(m.getAtIndex(10, 'q'))
// => 'q'

Overrides

SortedMap.getAtIndex

getInsertIndexOf

undocumented

Definition

abstract getInsertIndexOf(key: K): number;

Parameters

NameTypeDescription
keyK

getKeyAtIndex

undocumented

Definition

getKeyAtIndex<O>(index: number, otherwise?: OptLazy<O>): K | O;

Type parameters

NameDescription
O

Parameters

NameTypeDescription
indexnumber
otherwiseOptLazy<O>

Overrides

SortedMap.getKeyAtIndex

getSliceRange

undocumented

Definition

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

Parameters

NameTypeDescription
rangeRange<K>

getValueAtIndex

undocumented

Definition

getValueAtIndex<O>(index: number, otherwise?: OptLazy<O>): V | O;

Type parameters

NameDescription
O

Parameters

NameTypeDescription
indexnumber
otherwiseOptLazy<O>

Overrides

SortedMap.getValueAtIndex

hasKey

undocumented

Definition

hasKey<UK>(key: RelatedTo<K, UK>): boolean;

Type parameters

NameDescription
UK

Parameters

NameTypeDescription
keyRelatedTo<K, UK>

Overrides

VariantMapBase.hasKey

mapValues

undocumented

Definition

abstract mapValues<V2>(mapFun: (value: V, key: K) => V2): SortedMapNode<K, V2>;

Type parameters

NameDescription
V2

Parameters

NameTypeDescription
mapFun(value: V, key: K) => V2

Overrides

NonEmpty.mapValues

max

undocumented

Definition

abstract max(): readonly [K, V];

Overrides

NonEmpty.max

maxKey

undocumented

Definition

maxKey(): K;

Overrides

NonEmpty.maxKey

maxValue

undocumented

Definition

maxValue(): V;

Overrides

NonEmpty.maxValue

min

undocumented

Definition

abstract min(): readonly [K, V];

Overrides

NonEmpty.min

minKey

undocumented

Definition

minKey(): K;

Overrides

NonEmpty.minKey

minValue

undocumented

Definition

minValue(): V;

Overrides

NonEmpty.minValue

modifyAt

undocumented

Definition

modifyAt(atKey: K, options: {
    ifNew?: OptLazyOr<V, Token>;
    ifExists?: ((currentEntry: V, remove: Token) => V |Token)| V;
  }): SortedMap<K, V>;

Parameters

NameTypeDescription
atKeyK
options{
    ifNew?: OptLazyOr<V, Token>;
    ifExists?: ((currentEntry: V, remove: Token) => V |Token)| V;
  }

Overrides

RMapBase.modifyAt

modifyAtInternal

undocumented

Definition

abstract modifyAtInternal(atKey: K, options: {
    ifNew?: OptLazyOr<V, Token>;
    ifExists?: ((currentEntry: V, remove: Token) => V |Token)| V;
  }): SortedMapNode<K, V>;

Parameters

NameTypeDescription
atKeyK
options{
    ifNew?: OptLazyOr<V, Token>;
    ifExists?: ((currentEntry: V, remove: Token) => V |Token)| V;
  }

nonEmpty

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

Definition

nonEmpty(): this is WithKeyValue<Tp, K, V>['nonEmpty'];

example
HashMap.of([1, 1], [2, 2]).nonEmpty()   // => true

Overrides

VariantMapBase.nonEmpty, NonEmpty.nonEmpty

normalize

undocumented

Definition

abstract normalize(): SortedMap<K, V>;

removeKey

undocumented

Definition

removeKey<UK>(key: RelatedTo<K, UK>): SortedMap<K, V>;

Type parameters

NameDescription
UK

Parameters

NameTypeDescription
keyRelatedTo<K, UK>

Overrides

VariantMapBase.removeKey

removeKeyAndGet

undocumented

Definition

removeKeyAndGet<UK>(key: RelatedTo<K, UK>): [SortedMap<K, V>, V] | undefined;

Type parameters

NameDescription
UK

Parameters

NameTypeDescription
keyRelatedTo<K, UK>

Overrides

VariantMapBase.removeKeyAndGet

removeKeys

undocumented

Definition

removeKeys<UK>(keys: StreamSource<RelatedTo<K, UK>>): SortedMap<K, V>;

Type parameters

NameDescription
UK

Parameters

NameTypeDescription
keysStreamSource<RelatedTo<K, UK>>

Overrides

VariantMapBase.removeKeys

set

undocumented

Definition

set(key: K, value: V): SortedMap.NonEmpty<K, V>;

Parameters

NameTypeDescription
keyK
valueV

Overrides

RMapBase.set

slice

undocumented

Definition

slice(range: Range<K>): SortedMap<K, V>;

Parameters

NameTypeDescription
rangeRange<K>

Overrides

SortedMap.slice

sliceIndex

undocumented

Definition

sliceIndex(range: IndexRange): SortedMap<K, V>;

Parameters

NameTypeDescription
rangeIndexRange

Overrides

SortedMap.sliceIndex

stream

undocumented

Definition

abstract stream(options?: {
    reversed?: boolean;
  }): Stream.NonEmpty<readonly [K, V]>;

Parameters

NameTypeDescription
options{
    reversed?: boolean;
  }

Overrides

NonEmpty.stream

streamKeys

undocumented

Definition

streamKeys(options?: {
    reversed?: boolean;
  }): Stream.NonEmpty<K>;

Parameters

NameTypeDescription
options{
    reversed?: boolean;
  }

Overrides

NonEmpty.streamKeys

streamRange

undocumented

Definition

streamRange(keyRange: Range<K>, options?: {
    reversed?: boolean;
  }): Stream<readonly [K, V]>;

Parameters

NameTypeDescription
keyRangeRange<K>
options{
    reversed?: boolean;
  }

Overrides

SortedMap.streamRange

streamSliceIndex

undocumented

Definition

abstract streamSliceIndex(range: IndexRange, options?: {
    reversed?: boolean;
  }): Stream<readonly [K, V]>;

Parameters

NameTypeDescription
rangeIndexRange
options{
    reversed?: boolean;
  }

Overrides

SortedMap.streamSliceIndex

streamValues

undocumented

Definition

streamValues(options?: {
    reversed?: boolean;
  }): Stream.NonEmpty<V>;

Parameters

NameTypeDescription
options{
    reversed?: boolean;
  }

Overrides

NonEmpty.streamValues

take

undocumented

Definition

take(amount: number): SortedMap<K, V> | any;

Parameters

NameTypeDescription
amountnumber

Overrides

NonEmpty.take

toArray

undocumented

Definition

abstract toArray(): ArrayNonEmpty<readonly [K, V]>;

Overrides

NonEmpty.toArray

toBuilder

undocumented

Definition

toBuilder(): SortedMapBuilder<K, V>;

Overrides

RMapBase.toBuilder

toJSON

undocumented

Definition

toJSON(): ToJSON<(readonly [K, V])[]>;

Overrides

VariantMapBase.toJSON

toString

undocumented

Definition

toString(): string;

Overrides

VariantMapBase.toString

updateAt

undocumented

Definition

updateAt<U>(key: RelatedTo<K, U>, update: Update<V>): SortedMap.NonEmpty<K, V>;

Type parameters

NameDescription
U

Parameters

NameTypeDescription
keyRelatedTo<K, U>
updateUpdate<V>

Overrides

NonEmpty.updateAt