-
Book Overview & Buying
-
Table Of Contents
Learning Reactive Programming With Java 8
By :
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 emitted by the Observable instance creates by the scan() method. The function passed to the scan() method is called an accumulator.
Let's look at the marble diagram of the scan(Func2) method:

The items emitted by the scan() method can be generated...
Change the font size
Change margin width
Change background colour