findMap<U extends Object> method

  1. @override
Option<U> findMap<U extends Object>(
  1. Option<U> f(
    1. T
    )
)

Applies the function to the elements of iterator and returns the first non-none result.

Implementation

@override
Option<U> findMap<U extends Object>(Option<U> Function(T) f) {
  for (final element in this) {
    final result = f(element);
    if (result.isSome()) {
      return result;
    }
  }
  return None;
}