February 2020
Intermediate to advanced
412 pages
9h 36m
English
One of the most interesting blocking operators is blockingIterable(). Rather than returning a single emission like our previous examples, it provides the emissions as they become available through iterable<T>. The Iterator<T> provided by the Iterable<T> keeps blocking the iterating thread until the next emission is available, and the iteration ends when onComplete() is called. In the following code, we iterate through each returned String value to ensure that its length is actually 5:
import io.reactivex.rxjava3.core.Observable;import org.junit.Test;import static org.junit.Assert.assertTrue;public class Ch10_07 { @Test public void testIterable() { Observable<String> source = Observable.just("Alpha", "Beta", "Gamma", "Delta" ...
Read now
Unlock full access