class SortedMapEmpty<K,V>
undocumented
Implements: SortedMap<K,V>
Type parameters
Name | Default | Description |
---|---|---|
K | any | undocumented |
V | any | undocumented |
Properties
_NonEmptyType
undocumented
_NonEmptyType
Definition
_NonEmptyType:
SortedMap.NonEmpty
<K, V>;
context
undocumented
context
Definition
readonly context:
SortedMapContext
<K>;
Methods
addEntries
undocumented
addEntries
Definition
addEntries(entries:
StreamSource
<readonly [K, V]>):
SortedMap.NonEmpty
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
entries | StreamSource <readonly [K, V]> |
addEntry
undocumented
addEntry
Definition
addEntry(entry: readonly [K, V]):
SortedMap.NonEmpty
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
entry | readonly [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 | the amount of elements to drop |
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
get
undocumented
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.
getAtIndex
Definitions
getAtIndex(index: number): readonly [K, V]
|
undefined;
getAtIndex<O>(index: number, otherwise:
OptLazy
<O>): readonly [K, V]
|
O;
Parameters
Name | Type | Description |
---|---|---|
index | number | the index in the key sort order |
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.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
getKeyAtIndex
undocumented
getKeyAtIndex
getValueAtIndex
undocumented
getValueAtIndex
mapValues
undocumented
mapValues
max
Returns the entry with the maximum key of the SortedMap, or a fallback value (default: undefined) if the SortedMap is empty.
max
Definitions
max(): readonly [K, V]
|
undefined;
max<O>(otherwise:
OptLazy
<O>): readonly [K, V]
|
O;
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.max())
// => ['d', 4]
console.log(m.max('q'))
// => ['d', 4]
console.log(SortedMap.empty().max())
// => undefined
console.log(SortedMap.empty().max('q'))
// => 'q'
Overrides
maxKey
undocumented
maxKey
maxValue
undocumented
maxValue
min
Returns the entry with the minimum key of the SortedMap, or a fallback value (default: undefined) if the SortedMap is empty.
min
Definitions
min(): readonly [K, V]
|
undefined;
min<O>(otherwise:
OptLazy
<O>): readonly [K, V]
|
O;
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.min())
// => ['a', 1]
console.log(m.min('q'))
// => ['a', 1]
console.log(SortedMap.empty().min())
// => undefined
console.log(SortedMap.empty().min('q'))
// => 'q'
Overrides
minKey
undocumented
minKey
minValue
undocumented
minValue
modifyAt
undocumented
modifyAt
set
undocumented
set
slice
undocumented
slice
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.Definition
sliceIndex(range: IndexRange):
SortedMap
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
range | IndexRange | an IndexRange defining the sort order indices to include. |
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.sliceIndex({ start: 1, amount: 2 }).toArray())
// => [['b', 2], ['c', 3]]
Overrides
stream
undocumented
stream
streamKeys
undocumented
streamKeys
streamRange
undocumented
streamRange
streamSliceIndex
undocumented
streamSliceIndex
streamValues
undocumented
streamValues
take
Returns a SortedMap containing the the first amount
of elements of this SortedMap.
take
amount
of elements of this SortedMap.Definition
take(amount: number):
SortedMap
<K, V>;
Parameters
Name | Type | Description |
---|---|---|
amount | number | the amount of elements to keep |
a negative amount
takes 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.take(2).toArray())
// => [['a', 1], ['b', 2]]
console.log(m.take(-2).toArray())
// => [['c', ], ['d', 4]]
Overrides
toBuilder
undocumented
toBuilder
Definition
toBuilder():
SortedMapBuilder
<K, V>;