February 2020
Intermediate to advanced
412 pages
9h 36m
English
As we have seen, Observable produces emissions over time. Emissions are handed from the source down to the Observer sequentially. The 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 the emission of true or false.
But let's look at a simple example of a time-based Observable using Observable.interval(). It emits consecutive long values (starting at 0) with the specified time interval between emissions. Here, we have an Observable<Long> that emits every second:
import io.reactivex.rxjava3.core.Observable;import java.time.LocalDateTime;import java.util.concurrent.TimeUnit;public class Ch2_17 { public static ...
Read now
Unlock full access