-
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
1.x: scan with an initial factory callback #3959
Conversation
Why add the overload if it can be done with defer and scan then? |
Yep, it can be done. A decision has to be made if this convenience should make it into the library or not, and notify @NiteshKant the outcome in #3667. |
I'd like to see this overload in, thanks. |
I'm not strong against adding it but not like the idea of the new parameter order. I would give +1 if giving it a better name instead of changing the parameter order. By the way, there is already a Probably @benjchristensen should take a look since you removed it before. |
It was removed due to ambiguity as shown in #1881 (comment) As long as that issue is not recreated, I have nothing against the functionality pursued here. I too don't like solving the overload ambiguity by moving parameter order around. But there is no good solution, it's either that or a new name. |
As an alternative, I suggest extending |
The argument order bothers me as well. I'll close this and post a javadoc update instead. |
This PR adds an overload to
scan
which allows specifying an initial value factory. The initial value factory is invoked for each incoming Subscriber individually and provides a non-shared starting point for thescan
operation.I propose the
scan(Func2 accumulator, Func0 initialFactory)
parameter order because some Java 8+ compilers can't properly disambiguate withscan(R initialValue, Func2 accumulator)
, thinking that R can be madeFunc0
.Related: #3667