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
SortedMap
keeps the inserted keys in sorted order according to the context'scomp
instance.
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.
max
Definition
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.
maxKey
Definition
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.
maxValue
Definition
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.
min
Definition
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.
minKey
Definition
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.
minValue
Definition
minValue(): V;
const m = SortedMap.of(['b', 2], ['d', 4], ['a', 1], ['c', 3]).asNormal();
console.log(m.minValue())
// => 1
stream
undocumented
stream
Definition
stream(options?: {
reversed?: boolean;
}):
Stream.NonEmpty
<readonly [K, V]>;
Parameters
Name | Type | Description |
---|---|---|
options | { reversed?: boolean; } |
streamKeys
undocumented
streamKeys
Definition
streamKeys(options?: {
reversed?: boolean;
}):
Stream.NonEmpty
<K>;
Parameters
Name | Type | Description |
---|---|---|
options | { reversed?: boolean; } |
streamValues
undocumented
streamValues
Definition
streamValues(options?: {
reversed?: boolean;
}):
Stream.NonEmpty
<V>;
Parameters
Name | Type | Description |
---|---|---|
options | { reversed?: boolean; } |