June 2017
Intermediate to advanced
400 pages
8h 44m
English
As we have seen, Observables have a concept of emissions over time. Emissions are handed from the source up to the Observer sequentially. But these emissions can be spaced out over time depending on when the source provides them. Our JavaFX example with ToggleButton demonstrated this, as each click resulted in an emission of true or false.
But let's look at a simple example of a time-based Observable using Observable.interval(). It will emit a consecutive long emission (starting at 0) at every specified time interval. Here, we have an Observable<Long> that emits every second:
import io.reactivex.Observable; import java.util.concurrent.TimeUnit; public class Launcher { public static void main(String[]args) { Observable ...
Read now
Unlock full access