-
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
Fix javadoc for Observable.reduce() and Observable.reduceWith() #5406
Conversation
Could you also fix Flowable's javadoc? |
@akarnokd Done. |
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small original mention of Publisher
could be fixed.
* | ||
* // alternatively, by using compose to stay fluent | ||
* | ||
* source.compose(o -> | ||
* Publisher.defer(() -> o.reduce(new ArrayList<>(), (list, item) -> list.add(item))) | ||
* ); | ||
* Publisher.defer(() -> o.reduce(new ArrayList<>(), (list, item) -> list.add(item)).toFlowable()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be Flowable.defer
.
Updated according to the feedback. |
Great! |
Codecov Report
@@ Coverage Diff @@
## 2.x #5406 +/- ##
======================================
Coverage ? 96.19%
Complexity ? 5789
======================================
Files ? 630
Lines ? 41197
Branches ? 5728
======================================
Hits ? 39629
Misses ? 605
Partials ? 963
Continue to review full report at Codecov.
|
The sample code given in the javadoc for
Observable.reduce()
isn't compiling, since the function returns aSingle
.This PR changes it to a compiling example.
It also updates the javadoc for
reduceWith()
to better match its actual behaviour.Remark
I'm not sure whether the sample code for
reduce()
is needed at all. The problem that it addresses might be solved better by usingreduceWith()
, imho.Update
Flowable.reduce()
andFlowable.reduceWith()