RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.
@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) )
map
is still cleaner.
lock
and how is it working here?
lock.wait()
causes the current thread to wait until another thread invokes lock.notify()
or lock.notifyAll()
.main()
can not be finished until rx.Observable emits elements.lock
object, which will cause the main thread to continue till the end.
new AnyRef
instead of new Object()
.
interval
call?
a
, b
, c
emit elements on different threads
computation
does, but @DmitriyZaitsev might be right that it starts multiple threads.
map
functions be called parallely ?