@mlatu Why do you need map+filter? Just filter can already do the filtering and possible data manipulations (just nothing persistent).
flatMap is for one to many tranformations, map for one to one.
About preserving order, do you really need that in a reactive system? concatMap also evaluate everything serial i think, flatMap has the possibility to go concurrent if you need it.
Observable.range(10000000)./* map or flatmap */.subscribe(() -> endMeasure())
o.flatMap(x -> Observalbe.just(f(x)).filter(y -> y != null) )
mapis still cleaner.
lockand how is it working here?
lock.wait()causes the current thread to wait until another thread invokes
main()can not be finished until rx.Observable emits elements.
lockobject, which will cause the main thread to continue till the end.
new AnyRefinstead of
cemit elements on different threads
computationdoes, but @DmitriyZaitsev might be right that it starts multiple threads.