February 2020
Intermediate to advanced
412 pages
9h 36m
English
blockingNext() will return an iterable and block each iterator's next() request until the next value is provided. Emissions that occur after the last fulfilled next() request and before the current next() are ignored. In the following code example, we have a source that emits every microsecond (1/1,000th of a millisecond). Note that the iterable returned from blockingNext() ignores previous values that it missed:
import io.reactivex.rxjava3.core.Observable;import org.junit.Test;import java.util.concurrent.TimeUnit;public class Ch10_09 { @Test public void testBlockingNext() { Observable<Long> source = Observable.interval(1, TimeUnit.MICROSECONDS) .take(1000); Iterable<Long> iterable = source.blockingNext(); for (Long i: iterable) ...
Read now
Unlock full access