-
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
Observable.scan()
overload to take a factory for initial value?
#3667
Comments
Thanks @zsxwing. But |
If there is some agreement on what to do here, I can send a PR. |
Technically, you can implement |
PRs are always welcome and sometimes the only means to get people moving around here. |
See #3959. |
Currently the scan operator has an overload to take an initial value for the accumulation. The problem with this is that the initial value is the same for all subscribers of this observable, which hardly is intended by the user. It is actually a source of subtle bugs for a casual user.
I think there should atleast be an overload that instead of the realized initial value takes a factory for the initial value for each subscription. The underlying
OperatorScan
already supports an initial value factory.I would also suggest to either deprecate the current
scan()
method or if it is usable in some cases, atleast put a warning in the javadoc.The text was updated successfully, but these errors were encountered: