Skip to content

Instantly share code, notes, and snippets.

@anitaa1990
Created August 19, 2018 07:42
Show Gist options
  • Save anitaa1990/f19512cee4dbfee0ebcc2d5da0ffb3c9 to your computer and use it in GitHub Desktop.
Save anitaa1990/f19512cee4dbfee0ebcc2d5da0ffb3c9 to your computer and use it in GitHub Desktop.
Observable<String> alphabets1 = Observable
.interval(1, TimeUnit.SECONDS).map(id -> "A" + id);
Observable<String> alphabets2 = Observable
.interval(1, TimeUnit.SECONDS).map(id -> "B" + id);
Observable.concat(alphabets1, alphabets2)
.subscribe(new Observer<String>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(String s) {
System.out.println("onNext: " + s);
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment