indexOfEquivalent Method
Find the index of an element that compares as equivalent based on some criterion. If multiple elements are equivalent, the specific one returned is unspecified.
As an example, consider a SortedArray<ModelState>
which uses ModelState.id
as its ordering criterion. To find the index of a model by its Id,
use sortedArray.indexOfEquivalent((element) => compareStrings(element.id, modelId))
where modelId
is an Id64String.
indexOfEquivalent(criterion: (element: T) => number): number
Returns - number
The index of the first element found that meets the criterion, or -1 if no elements meet the criterion.
Defined in
- core/bentley/src/SortedArray.ts Line 175
Last Updated: 20 June, 2023