class SortedMapInner<K,V>
undocumented
Extends: SortedMapNode<K,V>
Type parameters
Name | Description |
---|---|
K | undocumented |
V | undocumented |
Properties
_NonEmptyType
undocumented
_NonEmptyType
children
undocumented
children
Definition
children: readonly
SortedMapNode
<K, V>[];
context
undocumented
context
isEmpty
Returns false since this collection is known to be non-empty.
isEmpty
mutateChildren
undocumented
mutateChildren
Definition
get mutateChildren():
SortedMapNode
<K, V>[];
size
undocumented
size
Methods
[Symbol.iterator]
Returns a FastIterator
instance used to iterate over the values of this Iterable
.
[Symbol.iterator]
FastIterator
instance used to iterate over the values of this Iterable
.addEntries
Returns the collection with the entries from the given StreamSource
entries
added.
addEntries
StreamSource
entries
added.Definition
addEntries(entries:
StreamSource
<readonly [K, V]>):
SortedMap.NonEmpty
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
entries | StreamSource <readonly [K, V]> |
HashMap.of([1, 'a']).addEntries([[2, 'b']]).toArray() // => [[1, 'a'], [2, 'b']]
Overrides
addEntry
Returns the collection with given entry
added.
addEntry
entry
added.Definition
addEntry(entry: readonly [K, V]):
SortedMap.NonEmpty
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
entry | readonly [K, V] |
HashMap.of([1, 'a']).addEntry([2, 'b']).toArray() // => [[1, 'a'], [2, 'b']]
HashMap.of([1, 'a']).addEntry([1, 'b']).toArray() // => [[1, 'b']]
Overrides
addInternal
undocumented
addInternal
Definition
addInternal(entry: readonly [K, V]):
SortedMapInner
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
entry | readonly [K, V] |
Overrides
asNormal
undocumented
asNormal
assumeNonEmpty
Returns a self reference since this collection is known to be non-empty.
assumeNonEmpty
copy
undocumented
copy
Definition
copy(entries?: readonly (readonly [K, V])[], children?: readonly
SortedMapNode
<K, V>[], size?: number):
SortedMapInner
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
entries | readonly (readonly [K, V])[] | |
children | readonly SortedMapNode <K, V>[] | |
size | number |
deleteMax
undocumented
deleteMax
Definition
deleteMax(): [readonly [K, V],
SortedMapInner
<K, V>];
deleteMin
undocumented
deleteMin
Definition
deleteMin(): [readonly [K, V],
SortedMapInner
<K, V>];
drop
Returns a SortedMap containing all but the the first amount
of elements of this SortedMap.
drop
amount
of elements of this SortedMap.Definition
drop(amount: number):
SortedMap
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
amount | number |
a negative amount
drops the last elements instead of the first, e.g. -2 is the last 2 elements
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.drop(2).toArray())
// => [['c', ], ['d', 4]]
console.log(m.drop(-2).toArray())
// => [['a', 1], ['b', 2]]
Overrides
dropInternal
undocumented
dropInternal
Definition
dropInternal(amount: number):
SortedMapNode
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
amount | number |
filter
undocumented
filter
forEach
undocumented
forEach
Definition
forEach(f: (entry: readonly [K, V], index: number, halt: () => void) => void, options?: {
state?:
TraverseState
;
}): void;
Parameters
Name | Type | Description |
---|---|---|
f | (entry: readonly [K, V], index: number, halt: () => void) => void | |
options | { state?: TraverseState ; } |
Overrides
get
undocumented
get
getAtIndex
undocumented
getAtIndex
getInsertIndexOf
undocumented
getInsertIndexOf
getKeyAtIndex
Returns the 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.
getKeyAtIndex
Definition
getKeyAtIndex<O>(index: number, otherwise?:
OptLazy
<O>): K
|
O;
Type parameters
Name | Description |
---|---|
O |
Parameters
Name | Type | Description |
---|---|---|
index | number | |
otherwise | OptLazy <O> |
negative index values will retrieve the values from the end of the sort order, e.g. -1 is the last value
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.getKeyAtIndex(1))
// => 'b'
console.log(m.getKeyAtIndex(-1))
// => 'd'
console.log(m.getKeyAtIndex(10))
// => undefined
console.log(m.getKeyAtIndex(10, 'q'))
// => 'q'
Overrides
getSliceRange
undocumented
getSliceRange
getValueAtIndex
Returns the value associated with the 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.
getValueAtIndex
Definition
getValueAtIndex<O>(index: number, otherwise?:
OptLazy
<O>): V
|
O;
Type parameters
Name | Description |
---|---|
O |
Parameters
Name | Type | Description |
---|---|---|
index | number | |
otherwise | OptLazy <O> |
negative index values will retrieve the values from the end of the sort order, e.g. -1 is the last value
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.getValueAtIndex(1))
// => 2
console.log(m.getValueAtIndex(-1))
// => 4
console.log(m.getValueAtIndex(10))
// => undefined
console.log(m.getValueAtIndex(10, 'q'))
// => 'q'
Overrides
hasKey
undocumented
hasKey
mapValues
undocumented
mapValues
Definition
mapValues<V2>(mapFun: (value: V, key: K) => V2):
SortedMapInner
<K, V2>;
Type parameters
Name | Description |
---|---|
V2 |
Parameters
Name | Type | Description |
---|---|---|
mapFun | (value: V, key: K) => V2 |
Overrides
max
undocumented
max
maxKey
Returns the maximum key of the SortedMap.
maxKey
maxValue
Returns the value associated with the maximum key of the SortedMap.
maxValue
min
undocumented
min
minKey
Returns the minimum key of the SortedMap.
minKey
minValue
Returns the value associated with the minimum key of the SortedMap.
minValue
modifyAt
Returns the collection with the given atKey
key modified according to given options
.
modifyAt
atKey
key modified according to given options
.Definition
modifyAt(atKey: K, options: {
ifNew?:
OptLazyOr
<V, Token>;
ifExists?: ((currentEntry: V, remove: Token) => V
|
Token)
|
V;
}):
SortedMap
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
atKey | K | |
options | { ifNew?: OptLazyOr <V, Token>; ifExists?: ((currentEntry: V, remove: Token) => V | Token) | V; } |
const m = HashMap.of([1, 'a'], [2, 'b'])
m.modifyAt(3, { ifNew: 'c' }).toArray()
// => [[1, 'a'], [2, 'b'], [3, 'c']]
m.modifyAt(3, { ifNew: (none) => 1 < 2 ? none : 'c' }).toArray()
// => [[1, 'a'], [2, 'b']]
m.modifyAt(2, { ifExists: () => 'c' }).toArray()
// => [[1, 'a'], [2, 'c']]
m.modifyAt(2, { ifExists: (v) => v + 'z' }).toArray()
// => [[1, 'a'], [2, 'bz']]
m.modifyAt(2, { ifExists: (v, remove) => v === 'a' ? v : remove }).toArray()
// => [[1, 'a']]
Overrides
modifyAtInternal
undocumented
modifyAtInternal
Definition
modifyAtInternal(key: K, options: {
ifNew?:
OptLazyOr
<V, Token>;
ifExists?: ((currentEntry: V, remove: Token) => V
|
Token)
|
V;
}):
SortedMapInner
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
key | K | |
options | { ifNew?: OptLazyOr <V, Token>; ifExists?: ((currentEntry: V, remove: Token) => V | Token) | V; } |
Overrides
mutateGetFromLeft
undocumented
mutateGetFromLeft
Definition
mutateGetFromLeft(left:
SortedMapInner
<K, V>, toMe: readonly [K, V]): [readonly [K, V],
SortedMapInner
<K, V>];
Parameters
Name | Type | Description |
---|---|---|
left | SortedMapInner <K, V> | |
toMe | readonly [K, V] |
mutateGetFromRight
undocumented
mutateGetFromRight
Definition
mutateGetFromRight(right:
SortedMapInner
<K, V>, toMe: readonly [K, V]): [readonly [K, V],
SortedMapInner
<K, V>];
Parameters
Name | Type | Description |
---|---|---|
right | SortedMapInner <K, V> | |
toMe | readonly [K, V] |
mutateGiveToLeft
undocumented
mutateGiveToLeft
Definition
mutateGiveToLeft(left:
SortedMapInner
<K, V>, toLeft: readonly [K, V]): [readonly [K, V],
SortedMapInner
<K, V>];
Parameters
Name | Type | Description |
---|---|---|
left | SortedMapInner <K, V> | |
toLeft | readonly [K, V] |
mutateGiveToRight
undocumented
mutateGiveToRight
Definition
mutateGiveToRight(right:
SortedMapInner
<K, V>, toRight: readonly [K, V]): [readonly [K, V],
SortedMapInner
<K, V>];
Parameters
Name | Type | Description |
---|---|---|
right | SortedMapInner <K, V> | |
toRight | readonly [K, V] |
mutateJoinLeft
undocumented
mutateJoinLeft
Definition
mutateJoinLeft(left:
SortedMapInner
<K, V>, entry: readonly [K, V]): void;
Parameters
Name | Type | Description |
---|---|---|
left | SortedMapInner <K, V> | |
entry | readonly [K, V] |
mutateJoinRight
undocumented
mutateJoinRight
Definition
mutateJoinRight(right:
SortedMapInner
<K, V>, entry: readonly [K, V]): void;
Parameters
Name | Type | Description |
---|---|---|
right | SortedMapInner <K, V> | |
entry | readonly [K, V] |
mutateSplitRight
undocumented
mutateSplitRight
Definition
mutateSplitRight(index?: number): [readonly [K, V],
SortedMapInner
<K, V>];
Parameters
Name | Type | Description |
---|---|---|
index | number |
nonEmpty
Returns true since this collection is known to be non-empty
nonEmpty
Definition
nonEmpty(): this is
WithKeyValue
<Tp, K, V>['nonEmpty'];
HashMap.of([1, 1], [2, 2]).nonEmpty() // => true
Overrides
normalize
undocumented
normalize
normalizeDownsizeChild
undocumented
normalizeDownsizeChild
Definition
normalizeDownsizeChild(childIndex: number, newChild:
SortedMapNode
<K, V>, newSize: number):
SortedMapInner
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
childIndex | number | |
newChild | SortedMapNode <K, V> | |
newSize | number |
normalizeIncreaseChild
undocumented
normalizeIncreaseChild
Definition
normalizeIncreaseChild(childIndex: number, newChild:
SortedMapNode
<K, V>, newSize: number):
SortedMapInner
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
childIndex | number | |
newChild | SortedMapNode <K, V> | |
newSize | number |
removeKey
undocumented
removeKey
removeKeyAndGet
undocumented
removeKeyAndGet
removeKeys
undocumented
removeKeys
Definition
removeKeys<UK>(keys:
StreamSource
<
RelatedTo
<K, UK>>):
SortedMap
<K, V>;
Type parameters
Name | Description |
---|---|
UK |
Parameters
Name | Type | Description |
---|---|---|
keys | StreamSource < RelatedTo <K, UK>> |
Overrides
set
Returns the collection with the given key
associated to the given value
.
set
key
associated to the given value
.Definition
set(key: K, value: V):
SortedMap.NonEmpty
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
key | K | |
value | V |
HashMap.of([1, 'a']).set(2, 'b').toArray() // => [[1, 'a'], [2, 'b']]
HashMap.of([1, 'a']).set(1, 'b').toArray() // => [[1, 'b']]
if the key is already associated, the previous value will be 'replaced'
Overrides
slice
Returns a SortedMap containing only those entries whose keys are within the given keyRange
.
slice
keyRange
.sliceIndex
Returns a SortedMap containing only those entries that are within the given range
index range of they key sort order.
sliceIndex
range
index range of they key sort order.stream
undocumented
stream
Definition
stream(options?: {
reversed?: boolean;
}):
Stream.NonEmpty
<readonly [K, V]>;
Parameters
Name | Type | Description |
---|---|---|
options | { reversed?: boolean; } |
Overrides
streamKeys
undocumented
streamKeys
Definition
streamKeys(options?: {
reversed?: boolean;
}):
Stream.NonEmpty
<K>;
Parameters
Name | Type | Description |
---|---|---|
options | { reversed?: boolean; } |
Overrides
streamRange
Returns a Stream of sorted entries of this collection within the given keyRange
.
streamRange
keyRange
.Definition
streamRange(keyRange: Range<K>, options?: {
reversed?: boolean;
}):
Stream
<readonly [K, V]>;
Parameters
Name | Type | Description |
---|---|---|
keyRange | Range<K> | |
options | { reversed?: boolean; } |
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]);
console.log(m.streamRange({ start: 'b', end: 'c' }).toArray())
// => ['b', 'c']
Overrides
streamSliceIndex
undocumented
streamSliceIndex
streamValues
undocumented
streamValues
Definition
streamValues(options?: {
reversed?: boolean;
}):
Stream.NonEmpty
<V>;
Parameters
Name | Type | Description |
---|---|---|
options | { reversed?: boolean; } |
Overrides
take
undocumented
take
takeInternal
undocumented
takeInternal
Definition
takeInternal(amount: number):
SortedMapNode
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
amount | number |
toArray
undocumented
toArray
toBuilder
Returns a builder object containing the entries of this collection.
toBuilder
Definition
toBuilder():
SortedMapBuilder
<K, V>;
const builder: HashMap.Builder<number, string> = HashMap.of([1, 'a'], [2, 'b']).toBuilder()
Overrides
toJSON
undocumented
toJSON
toString
undocumented
toString
updateAt
Returns the collection where the value associated with given key
is updated with the given update
value or update function.
updateAt
key
is updated with the given update
value or update function.Definition
updateAt<U>(key:
RelatedTo
<K, U>, update:
Update
<V>):
SortedMap.NonEmpty
<K, V>;
Type parameters
Name | Description |
---|---|
U |
Parameters
Name | Type | Description |
---|---|---|
key | RelatedTo <K, U> | |
update | Update <V> |
const m = HashMap.of([1, 'a'], [2, 'b'])
m.updateAt(3, 'a').toArray()
// => [[1, 'a'], [2, 'b']]
m.updateAt(2, 'c').toArray()
// => [[1, 'a'], [2, 'c']]
m.updateAt(2, v => v + 'z')
// => [[1, 'a'], [2, 'cz]]