I am studying the RxJava operator, and I found this code below, did not print anything:
public static void main(String[] args) { Observable .interval(1, TimeUnit.SECONDS) .subscribe(new Subscriber<Long>() { @Override public void onCompleted() { System.out.println("onCompleted"); } @Override public void onError(Throwable e) { System.out.println("onError -> " + e.getMessage()); } @Override public void onNext(Long l) { System.out.println("onNext -> " + l); } }); }
Like ReactiveX, interval
create an observable that emits a sequence of integers separated by a specific time interval
Did I make a mistake or forget about something?
rx-java
HuangDong.Li
source share