Book Image

Learning Reactive Programming with Java 8

By : Nickolay Tzvetinov
Book Image

Learning Reactive Programming with Java 8

By: Nickolay Tzvetinov

Overview of this book

Table of Contents (15 chapters)
Learning Reactive Programming with Java 8
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 4. Transforming, Filtering, and Accumulating Your Data

Now that we have the means for creating Observable instances from a wide variety of source data, it's time to build programming logic around these instances. We will present the basic reactive operators that we'll use to achieve step-by-step computations (the reactive way of handling data).

We will begin with transformations, using the famous flatMap() and map() operators, as well as some more less common transforming operators. After that we'll learn how to filter our data, using the filter() operator, skipping elements, receiving only elements at a given position in time. The chapter will also cover accumulating data with the scan operator. Most of these operators will be presented using marble diagrams.

This chapter covers the following topics:

  • Introduction to marble diagrams and transformations with mapping

  • Filtering your data

  • Accumulating values using the scan operator