Created
July 24, 2018 13:56
-
-
Save koji-k/153a0483766d57aee165dc6620de4b58 to your computer and use it in GitHub Desktop.
RxJavaでIntervalを設けつつのjustの使い方
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
import io.reactivex.Flowable; | |
import java.util.concurrent.TimeUnit; | |
public class Sample1 { | |
public static void main (String... args ) throws Exception { | |
Flowable<Integer> flowable1 = Flowable.just(1, 2, 3).map(s -> s * 2); | |
Flowable<Long> flowable2 = Flowable.interval(1000, TimeUnit.MILLISECONDS); | |
Flowable ziped = Flowable.zip(flowable1, flowable2, (f1, f2) ->f1); | |
ziped.subscribe(System.out::println); | |
Thread.sleep(5000L); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
もしかしてflowable2の方のintervalは終わらない?不安になったのでsubscribeでちゃんとFlowableSubscriberを実装して確認。
結論として問題なし。ちゃんとENDって表示されてる