I'm learning about RxJava operator, and I found these 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);
}
});
}
As ReactiveX, interval
create an Observable that emits a sequence of integers spaced by a particular time interval
Did I make a mistake or forget about something?