Accumulating data
The scan(Func2)
operator takes a function with two arguments as a parameter. Its result is an Observable
instance. The first item, emitted by the result of the scan()
method, is the first item of the source Observable
instance. The second item emitted is created by applying the function that was passed to the scan()
method on the previous item emitted by the result Observable
instance and the second item, emitted by the source Observable
instance. The third item, emitted by the scan()
method result, is created by applying the function, passed to the scan()
method to the previous item, emitted by it and the third item emitted by the source Observable
instance. This pattern continues in order to create the rest of the sequence ...
Get Learning Reactive Programming with Java 8 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.