February 2020
Intermediate to advanced
412 pages
9h 36m
English
Observable.range() creates an Observable that emits a consecutive range of integers. It emits each number from a start value and increments each subsequent value by one until the specified count is reached. These numbers are all passed through the onNext() event, followed by the onComplete() event:
import io.reactivex.rxjava3.core.Observable;public class Ch2_15 { public static void main(String[] args) { Observable.range(1, 3) .subscribe(s -> System.out.println("RECEIVED: " + s)); }}
The output looks as follows:
RECEIVED: 1RECEIVED: 2RECEIVED: 3
Note closely that the two arguments for Observable.range() are not lower and upper bounds. The first argument is the initial value. The second argument is the total count of emissions, ...
Read now
Unlock full access