O'Reilly logo

Reactive Android Programming by Tadas Subonis

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

Functional interfaces

In RxJava 1.0, the methods that handled actions (such as .doOnNext()) expected a certain type of Action interface that was usually named Action0 (no arguments), Action1 (one argument), and so on.

In the new release of RxJava, the developers decided to adopt functional interfaces from Java 8.

Now, types of  io.reactivex.functions.Action and  io.reactivex.functions.Consumer are used.

For example, .doOnNext() looks like this in the current version:

.doOnNext(new Consumer<Integer>() {    @Override    public void accept(Integer integer) throws Exception {    }})

It used to be something like this earlier:

.doOnNext(new Action1<Integer>() {    @Override    public void call(Integer integer) {    }})

The difference here is trivial, and it's ...

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