indexOf method
Implementation
Option<int> indexOf(A element, {int start = 0, Eq<A>? eq}) {
final effectiveEq = eq ?? ObjectEq;
return _elementsByIndex.cata(_NOT_FOUND, (_) => _NOT_FOUND, (result, index, v, cataLeft, cataRight) {
if ((index-_offset) < start) {
return cataRight(result);
} else {
return cataLeft(result)
.orElse(() => effectiveEq.eq(element, v) ? some(index-_offset) : _NOT_FOUND)
.orElse(() => cataRight(result));
}
});
}