Package rx.internal.operators
Class OperatorScan<R,T>
- java.lang.Object
-
- rx.internal.operators.OperatorScan<R,T>
-
- Type Parameters:
R
- the aggregate and output typeT
- the input value type
- All Implemented Interfaces:
Func1<Subscriber<? super R>,Subscriber<? super T>>
,Function
,Observable.Operator<R,T>
public final class OperatorScan<R,T> extends java.lang.Object implements Observable.Operator<R,T>
Returns an Observable that applies a function to the first item emitted by a source Observable, then feeds the result of that function along with the second item emitted by an Observable into the same function, and so on until all items have been emitted by the source Observable, emitting the result of each of these iterations.This sort of function is sometimes called an accumulator.
Note that when you pass a seed to
scan
the resulting Observable will emit that seed as its first emitted item.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
OperatorScan.InitialProducer<R>
-
Field Summary
Fields Modifier and Type Field Description (package private) Func2<R,? super T,R>
accumulator
private Func0<R>
initialValueFactory
private static java.lang.Object
NO_INITIAL_VALUE
-
Constructor Summary
Constructors Constructor Description OperatorScan(R initialValue, Func2<R,? super T,R> accumulator)
Applies an accumulator function over an observable sequence and returns each intermediate result with the specified source and accumulator.OperatorScan(Func0<R> initialValueFactory, Func2<R,? super T,R> accumulator)
OperatorScan(Func2<R,? super T,R> accumulator)
Applies an accumulator function over an observable sequence and returns each intermediate result with the specified source and accumulator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Subscriber<? super T>
call(Subscriber<? super R> child)
-
-
-
Constructor Detail
-
OperatorScan
public OperatorScan(R initialValue, Func2<R,? super T,R> accumulator)
Applies an accumulator function over an observable sequence and returns each intermediate result with the specified source and accumulator.- Parameters:
initialValue
- the initial (seed) accumulator valueaccumulator
- an accumulator function to be invoked on each element from the sequence- See Also:
- Observable.Scan(TSource, TAccumulate) Method (IObservable(TSource), TAccumulate, Func(TAccumulate, TSource, TAccumulate))
-
OperatorScan
public OperatorScan(Func2<R,? super T,R> accumulator)
Applies an accumulator function over an observable sequence and returns each intermediate result with the specified source and accumulator.- Parameters:
accumulator
- an accumulator function to be invoked on each element from the sequence- See Also:
- Observable.Scan(TSource) Method (IObservable(TSource), Func(TSource, TSource, TSource))
-
-
Method Detail
-
call
public Subscriber<? super T> call(Subscriber<? super R> child)
-
-