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

Using Transformation to track execution time

Another useful example for the ObservableTransformer can be the tracking of the emission times of the items produced by the Observable. In other words, how much times has passed since the start when this item was emitted.

Again, we will use a very similar approach as before. We will create a class, called TimingObservableTransformer:

package packt.reactivestocks;import io.reactivex.Observable;import io.reactivex.ObservableSource;import io.reactivex.ObservableTransformer;import io.reactivex.functions.Consumer;public class TimingObservableTransformer<R> implements ObservableTransformer<R, R> {    private final Consumer<Long> timerAction;    public TimingObservableTransformer(Consumer<Long> timerAction) ...

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