LoginSignup
0

More than 5 years have passed since last update.

RxJava2でFlowableにObservableをzipする

Posted at

FlowableとObservableをzipする場合、Flowable -> ObservableもしくはObservable -> Flowableに変換してどちらかに揃えるとzipすることができる

Flowable<Long> tictok = Flowable.interval(1, TimeUnit.SECONDS);
Observable<Integer> counter = Observable.fromArray(1).repeat();

tictok.zipWith(counter.toFlowable(BackpressureStrategy.LATEST), (t, c) -> t)
      .subscribeOn(Schedulers.newThread())
      .subscribe(System.out::println);

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0