interface SortedSet.Builder<T>
A mutable SortedSet
builder used to efficiently create new immutable instances. See the Set documentation and the SortedSet.Builder API documentation
Type parameters
Name | Description |
---|---|
T | the value type |
Methods
getAtIndex
Returns the value at the given index of the value sort order of the SortedSet builder, or a fallback value (default: undefined) if the index is out of bounds.
getAtIndex
Definitions
getAtIndex(index: number): T
|
undefined;
getAtIndex<O>(index: number, otherwise:
OptLazy
<O>): T
|
O;
Parameters
Name | Type | Description |
---|---|---|
index | number | the 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 b = SortedSet.of('b', 'd', 'a', 'c').toBuilder();
console.log(b.getAtIndex(1))
// => 'b'
console.log(b.getAtIndex(-1))
// => 'd'
console.log(b.getAtIndex(10))
// => undefined
console.log(b.getAtIndex(10, 'q'))
// => 'q'
max
Returns the maximum value of the SortedSet builder, or a fallback value (default: undefined) if the builder is empty.
max
min
Returns the minimum value of the SortedSet builder, or a fallback value (default: undefined) if the builder is empty.
min