Skip to content

Instantly share code, notes, and snippets.

@anitaa1990
Created August 19, 2018 09:29
Show Gist options
  • Save anitaa1990/b154fc63e82c58181fe83c409dc457a7 to your computer and use it in GitHub Desktop.
Save anitaa1990/b154fc63e82c58181fe83c409dc457a7 to your computer and use it in GitHub Desktop.
Observable.just(1l, 2l, 3l, 4l, 5l, 6l)
.timer(1, TimeUnit.SECONDS)
.timeout(500, TimeUnit.MILLISECONDS)
.subscribe(new Observer<Long>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Long aLong) {
System.out.println("onNext: " + aLong);
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
System.out.println("onError: ");
}
@Override
public void onComplete() {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment