Skip to content

Fix javadoc for Observable.reduce() and Observable.reduceWith()#5406

Merged
akarnokd merged 8 commits intoReactiveX:2.xfrom
devisnik:fix_javadoc_for_reduce
Jun 11, 2017
Merged

Fix javadoc for Observable.reduce() and Observable.reduceWith()#5406
akarnokd merged 8 commits intoReactiveX:2.xfrom
devisnik:fix_javadoc_for_reduce

Conversation

@devisnik
Copy link
Contributor

@devisnik devisnik commented Jun 11, 2017

The sample code given in the javadoc for Observable.reduce() isn't compiling, since the function returns a Single.
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 using reduceWith(), imho.

Update

  • similar changes applied to Flowable.reduce() and Flowable.reduceWith()

@akarnokd
Copy link
Member

Could you also fix Flowable's javadoc?

@akarnokd akarnokd added this to the 2.2 milestone Jun 11, 2017
@devisnik
Copy link
Contributor Author

@akarnokd Done.
What do you think about referring to reduceWith() instead of giving the example that uses defer()?

@akarnokd
Copy link
Member

The defer example should stay but you can add @see and a 3rd example.

Copy link
Member

@akarnokd akarnokd left a 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.

* 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())
Copy link
Member

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.

@devisnik
Copy link
Contributor Author

devisnik commented Jun 11, 2017

Updated according to the feedback.

@akarnokd
Copy link
Member

Great!

@codecov
Copy link

codecov bot commented Jun 11, 2017

Codecov Report

❗ No coverage uploaded for pull request base (2.x@c11f715). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##             2.x    #5406   +/-   ##
======================================
  Coverage       ?   96.19%           
  Complexity     ?     5789           
======================================
  Files          ?      630           
  Lines          ?    41197           
  Branches       ?     5728           
======================================
  Hits           ?    39629           
  Misses         ?      605           
  Partials       ?      963
Impacted Files Coverage Δ Complexity Δ
src/main/java/io/reactivex/Observable.java 100% <ø> (ø) 506 <0> (?)
src/main/java/io/reactivex/Flowable.java 100% <ø> (ø) 523 <0> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c11f715...6757548. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants