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

Pure functions and higher order functions

You don't have to remember most of the terms introduced in this chapter; the important thing is to understand how they help us write simplistic but powerful programs.

RxJava's approach has many functional ideas incorporated, so it is important for us to learn how to think in more functional ways in order to write better reactive applications.

Pure functions

A pure function is a function whose return value is only determined by its input, without observable side effects. If we call it with the same parameters n times, we are going to get the same result every single time. For example:

Predicate<Integer> even = (number) -> number % 2 == 0; int i = 50; while((i--) > 0) { System.out.println("Is five even? - " ...

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