@Test public void testScanIntegersWithInitialValue() { @SuppressWarnings("unchecked") Observer<String> observer = mock(Observer.class); Observable<Integer> observable = Observable.from(1, 2, 3); Observable<String> m = Observable.create(scan(observable, "", new Func2<String, Integer, String>() { @Override public String call(String s, Integer n) { return s + n.toString(); } })); m.subscribe(observer); verify(observer, never()).onError(any(Throwable.class)); verify(observer, times(1)).onNext(""); verify(observer, times(1)).onNext("1"); verify(observer, times(1)).onNext("12"); verify(observer, times(1)).onNext("123"); verify(observer, times(4)).onNext(anyString()); verify(observer, times(1)).onCompleted(); verify(observer, never()).onError(any(Throwable.class)); }
public static <T, R> OnSubscribeFunc<R> scan(Observable<? extends T> sequence, R initialValue, Func2<R, ? super T, R> accumulator) { return new Accumulator<T, R>(sequence, initialValue, accumulator); }
OperationScan { public static <T, R> OnSubscribeFunc<R> scan(Observable<? extends T> sequence, R initialValue, Func2<R, ? super T, R> accumulator) { return new Accumulator<T, R>(sequence, initialValue, accumulator); } }
OperationScan { public static <T, R> OnSubscribeFunc<R> scan(Observable<? extends T> sequence, R initialValue, Func2<R, ? super T, R> accumulator) { return new Accumulator<T, R>(sequence, initialValue, accumulator); }  }
OperationScan { public static <T, R> OnSubscribeFunc<R> scan(Observable<? extends T> sequence, R initialValue, Func2<R, ? super T, R> accumulator) { return new Accumulator<T, R>(sequence, initialValue, accumulator); }  static OnSubscribeFunc<R> scan(Observable<? extends T> sequence, R initialValue, Func2<R, ? super T, R> accumulator); static OnSubscribeFunc<T> scan(Observable<? extends T> sequence, Func2<T, T, T> accumulator); }
OperationScan { public static <T, R> OnSubscribeFunc<R> scan(Observable<? extends T> sequence, R initialValue, Func2<R, ? super T, R> accumulator) { return new Accumulator<T, R>(sequence, initialValue, accumulator); }  static OnSubscribeFunc<R> scan(Observable<? extends T> sequence, R initialValue, Func2<R, ? super T, R> accumulator); static OnSubscribeFunc<T> scan(Observable<? extends T> sequence, Func2<T, T, T> accumulator);  }