binarySearch

fun MutableEventIdentifierGapBuffer.binarySearch(    element: EventIdentifier,     fromIndex: Int = 0,     toIndex: Int = size): Int

Searches this MutableEventIdentifierGapBuffer for the provided element using the binary search algorithm. The array is expected to be sorted, otherwise the result is undefined.

If the list contains multiple elements equal to the specified element, there is no guarantee which one will be found.

The implementation is adapted from List.binarySearch.

Return

the index of the element, if it is contained in the array within the specified range; otherwise the inverted insertion point (-insertion point - 1).


fun MutableIntGapBuffer.binarySearch(    element: Int,     fromIndex: Int = 0,     toIndex: Int = size): Int

Searches this MutableIntGapBuffer for the provided element using the binary search algorithm. The array is expected to be sorted, otherwise the result is undefined.

If the list contains multiple elements equal to the specified element, there is no guarantee which one will be found.

The implementation is adapted from List.binarySearch.

Return

the index of the element, if it is contained in the array within the specified range; otherwise the inverted insertion point (-insertion point - 1).