[RxJava version 3]
The link below shows how to pass variables along when chaining observables using nested observables:
In RxJava, how to pass a variable along when chaining observables?
However, it does not seem to work when the data all comes from a single observable. For example, in a data structure:
obs.flatMap(dataStructure ->
obs.map(dataStructure1 ->
dataStructure1.b).map(b ->
foobar(dataStructure.a, b)));
Presumably this does not work because I am trying to take from the same observable twice, it processes all combinations of a and b twice. Apart from all that it seems ugly, is there a simple way to achieve what I want while being able to arbitrarily add things to the chain (e.g. do more operations to b before calling foobar)?