These are chat archives for ReactiveX/RxJava

3rd
Nov 2015
Dorus
@Dorus
Nov 03 2015 00:10
Also i'm not sure what's going on in the final map. You seem to add back all previous data (in case some id's where unused last second). Is that truly by the spec? If so, i would think there is no need to use window, just scan the original source instead of collect, and sample the result.
Also reduced == output, so you can just used reduced in subscribe.
David Stemmer
@weefbellington
Nov 03 2015 02:08
@Dorus doesn't scan/reduce only emit a single value when the original source completes? In this case the source observable is hot, it may never complete. Maybe I'm misunderstanding what you're suggesting.
It doesn't look like reducedis the same as output to me, either. The output of each window is a Map. The final step is merging the map emitted by the current window with the map from the previous window.
Dorus
@Dorus
Nov 03 2015 11:35
@weefbellington scan emit all intermediate values also. Not sure if that bode well if you are emitting the same mutable datatype each time.
The map ends with return output;. If i understand that correctly that means that in .subscribe(reduced -> ...) , reduced is the output variable returned by map.
David Stemmer
@weefbellington
Nov 03 2015 14:15
@Dorus aha! So that is the difference between scan and reduce! I had thought they were aliases for the same operation. In that case, yes, scan with the values stored in a map is the way to go!
@Dorus thanks for pointing that out!