find method

Option<A> find(
  1. Function1<A, bool> p
)

Returns the first element from this collection that satisfies the given predicate p. If no element satisfies p, None is returned.

Implementation

Option<A> find(Function1<A, bool> p) {
  final it = iterator;

  while (it.hasNext) {
    final a = it.next();
    if (p(a)) return Some(a);
  }

  return none();
}