Created
August 19, 2018 10:48
-
-
Save anitaa1990/2e8a40a7ebdebe8994a68097331c8e9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Observable<Integer> observable1 = Observable | |
.create(emitter -> { | |
for(int i=0; i<= 6; i++) { | |
Thread.sleep(1000); | |
emitter.onNext(i); | |
} | |
emitter.onComplete(); | |
}); | |
Observable<Integer> observable2 = Observable | |
.timer(3, TimeUnit.SECONDS) | |
.flatMap(__ -> Observable.just(11, 12, 13, 14, 15, 16)); | |
observable1.skipUntil(observable2) | |
.subscribe(new Observer<Integer>() { | |
@Override | |
public void onSubscribe(Disposable d) { | |
} | |
@Override | |
public void onNext(Integer integer) { | |
System.out.println("onNext: " + integer); | |
} | |
@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