binarySearch method
Returns a position of the value
in this list, if it is there.
If the list isn't sorted according to the compare
function, the result
is unpredictable.
If compare
is omitted, this defaults to calling Comparable.compareTo
on the objects. If any object is not Comparable, this throws a
CastError
.
Returns -1 if value
is not in the list by default.
Implementation
int binarySearch(E value, {int Function(E a, E b)? compare}) {
return _binarySearch(this, value, compare: compare);
}