June 2017
Intermediate to advanced
400 pages
8h 44m
English
The repeat() operator will repeat subscription upstream after onComplete() a specified number of times.
For instance, we can repeat the emissions twice for a given Observable by passing a long 2 as an argument for repeat(), as shown in the following code snippet:
import io.reactivex.Observable;public class Launcher { public static void main(String[] args) { Observable.just("Alpha", "Beta", "Gamma" ,"Delta", "Epsilon") .repeat(2) .subscribe(s -> System.out.println("Received: " + s)); }}
The output of the preceding code snippet is as follows:
Received: Alpha Received: Beta Received: Gamma Received: Delta Received: Epsilon Received: Alpha Received: Beta Received: Gamma Received: Delta Received: Epsilon
If you do not specify a number, ...
Read now
Unlock full access