The map() operator

From the preceding Fibonacci example that was used to explain the skip() operator, suppose that we want to convert the first 10 elements into Roman numeral equivalents.

Roman numerals are represented by seven letters: I, V, X, L, C, D, and M. These letters represent 1, 5, 10, 50, 100, 500, and 1,000, respectively. The seven letters can be combined to represent thousands of numbers. The Roman numeral scheme used letters as tally markers. Markers were combined to represent unit values.

We have a long number and we want to convert it to its Roman equivalent; this is where the map() operator is valuable. It applies a transformation to each and every value of the existing stream, as follows:

In order to achieve this transformation, ...

Get Hands-On Reactive Programming with Reactor now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.