position method

  1. @override
Option<int> position(
  1. bool f(
    1. T
    )
)

Searches for an element in an iterator, returning its index.

Implementation

@override
Option<int> position(bool Function(T) f) {
  var index = 0;
  for (final element in this) {
    if (f(element)) {
      return Some(index);
    }
    index++;
  }
  return None;
}