February 2020
Intermediate to advanced
412 pages
9h 36m
English
blockingMostRecent() is similar to blockingLatest(), but it reconsumes the latest value repeatedly for every next() call from the iterator, even if already consumed. It also requires a defaultValue argument so that it has something to return if no value is emitted yet. In the following example, we use blockingMostRecent() against an Observable emitting every 10 milliseconds, and the default value is -1:
import io.reactivex.rxjava3.core.Observable;import org.junit.Test;import java.util.concurrent.TimeUnit;public class Ch10_11 { @Test public void testBlockingMostRecent() { Observable<Long> source = Observable.interval(10, TimeUnit.MILLISECONDS) .take(5); Iterable<Long> iterable = source.blockingMostRecent(-1L); for (Long ...
Read now
Unlock full access