binarySearchBy<K extends Comparable<K> > method
Null safety
Returns the index of element
in this sorted list.
Uses binary search to find the location of element
.
The list must be sorted according to the natural ordering of
the keyOf
of elements, otherwise the result is unspecified.
Returns -1 if element
does not occur in this list.
If start
and end
are supplied, only the list range from start
to end
is searched, and only that range needs to be sorted.
Implementation
int binarySearchBy<K extends Comparable<K>>(
E element, K Function(E element) keyOf, [int start = 0, int? end]) =>
algorithms.binarySearchBy<E, K>(
this, keyOf, (a, b) => a.compareTo(b), element, start, end);