These are chat archives for ReactiveX/RxJava

13th
Feb 2017
Bojan Šernek
@baadc0de
Feb 13 2017 16:34
A Flowable is put into a function (let's call it 'A') that returns a Flowable as well (let's call it 'B'). An implicit contract says that the new flowable will emit one item for every item emitted by the original Flowable, but not necessarily soon (there could be a .mapAsync and similar stuff in there). I would like to write a function that gets one item from 'A' and one item from 'B' in such a way that I know that what I got from 'B' was derived from what I got from 'A'. Hopefully that makes sense :)
Bojan Šernek
@baadc0de
Feb 13 2017 16:49
Would this work?
  override def apply(t: Flowable[AType]): Flowable[AType] = {
    t.flatMap(buffer => {
      Flowable.zip(f(Flowable.just(buffer)), Flowable.just(buffer), (processed: AType, unprocessed: AType) => {
        if (decision) unprocessed else processed
      })
    })
  }
in this context f is the other function that returns the new 1:1 flowable