October 2018
Intermediate to advanced
556 pages
15h 18m
English
Flux and Mono provide many factory methods to create Reactive Streams based on data that is already available. For example, we may create Flux with object references or from a collection, or we may even create our own lazy range of numbers:
Flux<String> stream1 = Flux.just("Hello", "world"); Flux<Integer> stream2 = Flux.fromArray(new Integer[]{1, 2, 3}); Flux<Integer> stream3 = Flux.fromIterable(Arrays.asList(9, 8, 7));
It is easy to generate a stream of integers with the range method, where 2010 is a starting point, and 9 is the number of elements in the sequence:
Flux<Integer> stream4 = Flux.range(2010, 9);
This is a handy way to generate a stream of recent years, so the preceding code generates the ...
Read now
Unlock full access