API Reference > bentleyjs-core > Collections > ReadonlySortedArray > indexOfEquivalent 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 Parameter Type Description criterion (element: T) => number A function accepting an element and returning 0 if it compares as equivalent, a negative number if the element compares as "less-than", or a positive value if the element compares as "greater-than". 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 173 Last Updated: 11 June, 2024