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

Preserve latest item

Preserving the last items means that if the downstream cannot cope with the items that are being sent to them, the app will stop emitting values and wait until they become available. While waiting, it will keep dropping all the values except the last one that arrived and when the downstream becomes available, send the last message that's currently stored.

Like with Dropping, the Latest strategy can be specified while creating an Observable:

observable.toFlowable(BackpressureStrategy.LATEST)

Alternatively, by calling .onBackpressure():

observable.toFlowable(BackpressureStrategy.MISSING)        .onBackpressureLatest()

Finally, a method, .debounce(), can periodically take the last value at specific intervals:

 observable.toFlowable(BackpressureStrategy. ...

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