https://kotlinlang.org logo
#rx
Title
# rx
a

am414

11/25/2019, 3:59 AM
I don't know why this emits immediately not after 30seconds anyone know, What is I am missing here? ??
Copy code
Observable<Integer> ob = Observable.timer(30,TimeUnit.SECONDS).just(1);

        ob.subscribe(n-> System.out.println(n));
m

Matthieu Esnault

11/25/2019, 5:24 AM
This is a Kotlin Slack, so I think the most important thing you’re missing is Kotlin.
Observable.just
is static, so : • Your statement doesn’t compile in Kotlin • There is a warning in java that explains the problem
Observable.timer
emits
0L
and completes, so if you need a 1, you can : •
Observable.timer
and then
map
the 0 to 1 •
Observable.just
1 and
delay
the emission
2 Views