Skip to Content
Hands-On Reactive Programming in Spring 5
book

Hands-On Reactive Programming in Spring 5

by Oleh Dokuka, Igor Lozynskyi
October 2018
Intermediate to advanced
556 pages
15h 18m
English
Packt Publishing
Content preview from Hands-On Reactive Programming in Spring 5

The flatMap, concatMap, and flatMapSequential operators

Of course, Project Reactor could not omit the implementation of the flatMap operator as it is a crucial transformation in functional programming itself.

The flatMap operator logically consists of  two operations—map and flatten (in terms of Reactor, flatten is similar to the merge operator). The map part of the flatMap operator transforms each incoming element into a Reactive Stream (T -> Flux<R>), and the flatten part merges all generated reactive sequences into a new reactive sequence, through which it passes elements of type R

The following marble diagram may help us grasp the idea:

Diagram 4.7. Operator: flatMap

In the preceding diagram, for each circle(n), we generate square(n) ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Spring Microservices in Action, Second Edition

Spring Microservices in Action, Second Edition

John Carnell, Illary Huaylupo Sanchez

Publisher Resources

ISBN: 9781787284951Supplemental Content