I\'m learning RxJava and, as my first experiment, trying to rewrite the code in the first run()
method in this code (cited on Netflix\'s blog as a problem RxJava ca
It looks like all you really need is a bit more encouragement and perspective on how RX is used. I'd suggest you read more into the documentation as well as marble diagrams (I know they're not always useful). I also suggest looking into the lift()
function and operators.
map
, flatMap
and filter
are to manipulate the data in your data flowThe point of operators are to allow you to disrupt a steady stream of observables and define your own operations on a data flow. For example, I coded a moving average operator. That sums up n
double
s in an Observable of doubles to return a stream of moving averages. The code literally looked like this
Observable movingAverage = Observable.from(mDoublesArray).lift(new MovingAverageOperator(frameSize))
You'll be a relieved that a lot of the filtering methods that you take for granted all have lift()
under the hood.
With that said; all it takes to merge multiple dependencies is:
map
or flatMap