Before we jump into working with various operators, let's first generate a stream of data. In order to do this, let's revisit our Fibonacci series from Chapter 1, Getting Started with Reactive Streams.
In number theory, Fibonacci numbers are characterized by the fact that every number after the first two numbers is the sum of the two preceding ones (that is, 0 , 1 , 1 , 2 , 3 , 5 , 8 , 13 ,21 , 34 , 55 , 89 , 144, and so on).
The Flux generated API enables us to build a generator. These generators start the series from 0 and 1. All numbers are printed to the console by a subscriber, which listens to all of the generated events. This is shown in the following code:
Flux<Long> fibonacciGenerator = Flux.generate(() -> Tuples.<Long, ...