Is there any operator in RxJava2 which can apply a transformation from Flowable to Single or Maybe? I mean Flowable.compose() operator applies a Transformer to a Flowable and returns another Flowable. But I need to apply a transformer which converts a Flowable into a Single or Mabye and which can further be reused multiple times in my application without "breaking the chain".
Example (in Kotlin):
fun processFirstEven(f: Flowable<Int>): Maybe<Int> {
return f.filter { i -> i % 2 == 0 }.take(1).singleElement().map { s -> s * 12 }
}
val f: Maybe<Int> = Flowable
.fromArray(1, 3, 5, 6, 7, 8, 9)
.compose(::processFirstEven) // Does not compile
toorasinstead ofcompose. - akarnokd