October 2018
Intermediate to advanced
556 pages
15h 18m
English
It is possible to collect all elements in the list and process the resulting collection as a Mono stream with Flux.collectList() and Flux.collectSortedList(). The last one not only collects elements but also sorts them. Consider the following code:
Flux.just(1, 6, 2, 8, 3, 1, 5, 1) .collectSortedList(Comparator.reverseOrder()) .subscribe(System.out::println);
This produces the following output with one collection containing sorted numbers:
[8, 6, 5, 3, 2, 1, 1, 1]
Project Reactor allows ...