Is there an operator that allows me to iterate over elements of a stream and concatenate them instead of transforming them?
Consider the following stream:
A => B => C
If I use items$.concatMap(x => f(x))
, the result will be:
"f(A)" => "f(B)" => "f(C)"
Using the concat
operator won't work as it doesn't receive individual elements as parameters.
What I want to achieve is:
"A" => "B" => "C" => "f(A)" => "f(B)" => "f(C)"
One way to do this is by breaking up the stream and storing it as follows:
item$ = Observable.of("A","B","C");
item$.concat(item$.map(x => f(x)));