scan<S> method

Observable<S> scan <S>(
  1. S accumulator(
    1. S accumulated,
    2. T value,
    3. int index
    ),
  2. [S seed]
)
inherited

Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.

Example

new Observable.fromIterable([1, 2, 3])
   .scan((acc, curr, i) => acc + curr, 0)
   .listen(print); // prints 1, 3, 6

Implementation

Observable<S> scan<S>(S accumulator(S accumulated, T value, int index),
        [S seed]) =>
    transform(ScanStreamTransformer<T, S>(accumulator, seed));