interface SortedMap.NonEmpty<K,V>
A non-empty type-invariant immutable Map of key type K, and value type V. In the Map, each key has exactly one value, and the Map cannot contain duplicate keys. See the Map documentation and the SortedMap API documentation
Type parameters
| Name | Description |
|---|---|
| K | the key type |
| V | the value type |
- The
SortedMapkeeps the inserted keys in sorted order according to the context'scompinstance.
const m1 = SortedMap.empty<number, string>()
const m2 = SortedMap.of([1, 'a'], [2, 'b'])
Methods
max
Returns the entry with the maximum key of the SortedMap.
maxDefinition
max(): readonly [K, V];
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.max())
// => ['d', 4]
maxKey
Returns the maximum key of the SortedMap.
maxKeyDefinition
maxKey(): K;
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.maxKey())
// => 'a'
maxValue
Returns the value associated with the maximum key of the SortedMap.
maxValueDefinition
maxValue(): V;
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.maxValue())
// => 4
min
Returns the entry with the minimum key of the SortedMap.
minDefinition
min(): readonly [K, V];
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]);
console.log(m.min())
// => ['a', 1]
minKey
Returns the minimum key of the SortedMap.
minKeyDefinition
minKey(): K;
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]);
console.log(m.minKey())
// => 'a'
minValue
Returns the value associated with the minimum key of the SortedMap.
minValueDefinition
minValue(): V;
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.minValue())
// => 1
stream
undocumented
streamDefinition
stream(options?: {
reversed?: boolean;
}): Stream.NonEmpty<readonly [K, V]>;
Parameters
| Name | Type | Description |
|---|---|---|
options | {reversed?: boolean;} |
streamKeys
undocumented
streamKeysDefinition
streamKeys(options?: {
reversed?: boolean;
}): Stream.NonEmpty<K>;
Parameters
| Name | Type | Description |
|---|---|---|
options | {reversed?: boolean;} |
streamValues
undocumented
streamValuesDefinition
streamValues(options?: {
reversed?: boolean;
}): Stream.NonEmpty<V>;
Parameters
| Name | Type | Description |
|---|---|---|
options | {reversed?: boolean;} |