scan<U extends Object> method

  1. @override
Iter<U> scan<U extends Object>(
  1. U initial,
  2. Option<U> f(
    1. U,
    2. T
    )
)

An iterator which, like fold, holds internal state, but unlike fold, produces a new iterator. On iteration, the closure will be applied to each element of the iterator and the return value from the closure. The closure can return Some(value) to yield value, or None to end the iteration.

Implementation

@override
@pragma("vm:prefer-inline")
Iter<U> scan<U extends Object>(U initial, Option<U> Function(U, T) f) {
  return Iter.fromIterable(_scanHelper(initial, f));
}