Brais Gabin
02/06/2021, 12:34 PMjoin
in RxJava? I have a flow of files and a flow of processors and I need to run all the processors through all the files. I'm looking for something like: filesFlow.join(processorsFlow) { file, processor -> processor.invoke(file) }
(proccessor.invoke
returns the result of the processor so I get new flow of type result)fun <A, B, AB> Flow<A>.join(
flowB: Flow<B>,
selector: (A, B) -> AB
): Flow<AB> {
return this.flatMapMerge { a -> flowB.map { b -> selector(a, b) } }
}
But with this solution I'm subscribing multiple times to flowB.Dominaezzz
02/06/2021, 12:57 PMSharedFlow
with infinite replay buffer to only subscribe once.Brais Gabin
02/06/2021, 1:03 PMSharedFlow
too. 😭 we need a sharable & finishable Flow
.Dominaezzz
02/06/2021, 1:08 PMephemient
02/06/2021, 3:02 PMErik
02/06/2021, 5:48 PMephemient
02/06/2021, 8:30 PM