O'Reilly logo

Learning Reactive Programming with Java 8 by Nickolay Tsvetinov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Filtering data

In the first chapter's reactive sum example, we were filtering the user input, based on a special pattern. The pattern was, for example, a: <number>. It is common to filter only interesting bits of data from the data stream. For example, it's useful to filter out <enter> key-down events only from all key-down events, or only lines containing a given expression from a file. That's why it is important to not only be able to transform our data but also to learn how to filter it.

There are many filtering operators in RxJava. The most important of these operators is filter(). Its marble diagram is very simple and is shown here:

Filtering data

It shows ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required