February 2020
Intermediate to advanced
412 pages
9h 36m
English
The iterable from blockingLatest(), on the other hand, does not wait for the next value. Instead, it requests the last emitted value. Any previous values that were not captured are forgotten. It does not reconsume the latest value if the iterator's next() consumed it previously and blocks until the next one comes. The following code demonstrates this behavior:
import io.reactivex.rxjava3.core.Observable;import org.junit.Test;import java.util.concurrent.TimeUnit;public class Ch10_10 { @Test public void testBlockingLatest() { Observable<Long> source = Observable.interval(1, TimeUnit.MICROSECONDS) .take(1000); Iterable<Long> iterable = source.blockingLatest(); for (Long i: iterable) { System.out.println(i); } }}
The output obtained ...
Read now
Unlock full access