-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
map doesn't work with random numbers #719
Comments
This behavior is the expected behavior. Remove the line |
You have discovered the distinction between "hot" and "cold" observables and the evil that is side-effects. http://www.introtorx.com/content/v1.0.10621.0/14_HotAndColdObservables.html |
following up on a previous comment, your code should read something like this:
|
Note that we will be changing the Scala bindings to use ConnectableObservable so while this code work now, in the future you would write something like so: val observable = Observable.interval(250 millis).map(x => math.random).take(10).publish observable.subscribe(x => println(s"n = $x")) observable.connect |
Ah, gotcha.. thanks for the clarification! |
This may be specific to the Scala Adapter or a general issue.. I'm not sure. It may also be simply disallowed somewhere in the documentation but I couldn't find anything mentioning it.
produces
Of course, we expect the values of the two Observables to be equal but they aren't related whatsoever.
The text was updated successfully, but these errors were encountered: