indexOf<T extends Comparable<T> > function
Locate the leftmost value exactly equal to x
.
Implementation
@Deprecated('Use List extension methods') // since 2021-11
int? indexOf<T extends Comparable<T>>(List<T> a, T x,
{bool dontPanic = false}) {
final i = bisect_left<T>(a, x);
if (i != a.length && a[i].compareTo(x) == 0) {
return i;
}
if (dontPanic) {
return null;
} else {
throw ItemNotFoundError();
}
}