lowerBound Function
Given a sorted array, computes the position at which the specified value should be inserted into the array so that the array remains sorted.
lowerBound<T, U>(value: T, list: U[], compare: OrderedComparator<T, U>): { equal: boolean, index: number }
@returns an object with 'index' corresponding to the computed position and 'equal' set to true if an equivalent element already exists at that index.
Parameter | Type | Description |
---|---|---|
value | T | The value whose position is to be computed. |
list | U[] | An array of U already sorted according to the comparison criterion. |
compare | OrderedComparator<T, U> | The function used to compare the value with elements in list . |
Returns - { equal: boolean, index: number }
an object with 'index' corresponding to the computed position and 'equal' set to true if an equivalent element already exists at that index.
Defined in
- core/bentley/src/SortedArray.ts Line 37
Last Updated: 21 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.