Skip to content
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

2.x: Detail distinct() & distinctUntilChanged() in JavaDoc #5837

Merged
merged 2 commits into from
Feb 3, 2018

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Feb 2, 2018

The PR clarifies the comparison and retention behavior of the distinct and distinctUntilChanged operators (in both Flowable and Observable).

@akarnokd akarnokd added this to the 2.2 milestone Feb 2, 2018
@akarnokd akarnokd force-pushed the DistinctUntilChangedClarification branch from 254ae70 to 4d043b2 Compare February 2, 2018 17:59
@codecov
Copy link

codecov bot commented Feb 2, 2018

Codecov Report

Merging #5837 into 2.x will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##                2.x   #5837      +/-   ##
===========================================
+ Coverage     96.39%   96.4%   +<.01%     
- Complexity     5813    5817       +4     
===========================================
  Files           634     634              
  Lines         41760   41760              
  Branches       5796    5796              
===========================================
+ Hits          40256   40257       +1     
+ Misses          583     578       -5     
- Partials        921     925       +4
Impacted Files Coverage Δ Complexity Δ
src/main/java/io/reactivex/Observable.java 100% <ø> (ø) 509 <0> (ø) ⬇️
src/main/java/io/reactivex/Flowable.java 100% <ø> (ø) 526 <0> (ø) ⬇️
...l/operators/observable/ObservableFlatMapMaybe.java 84.96% <0%> (-6.54%) 2% <0%> (ø)
...perators/single/SingleFlatMapIterableFlowable.java 95.83% <0%> (-2.5%) 2% <0%> (ø)
...ex/internal/operators/flowable/FlowableCreate.java 95.16% <0%> (-2.26%) 6% <0%> (ø)
...ain/java/io/reactivex/subjects/PublishSubject.java 97.8% <0%> (-2.2%) 38% <0%> (-1%)
...activex/internal/schedulers/ExecutorScheduler.java 96.66% <0%> (-2%) 9% <0%> (ø)
...ex/internal/subscribers/InnerQueuedSubscriber.java 96.07% <0%> (-1.97%) 18% <0%> (-1%)
...rnal/operators/flowable/FlowableFlatMapSingle.java 91.84% <0%> (-1.64%) 2% <0%> (ø)
...vex/internal/subscribers/QueueDrainSubscriber.java 50% <0%> (-1.57%) 15% <0%> (-1%)
... and 29 more

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 7e9eb4f...b1867be. Read the comment docs.

* It is recommended the elements' class {@code T} in the flow overrides the default {@code Object.equals()} to provide
* meaningful comparison between items as the default Java implementation only considers reference equivalence.
* <p>
* By default, {@code distinct()} uses an internal, per Subscriber {@link java.util.HashSet} to remember
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supernit: could be phrased like that By default, {@code distinct()} uses an internal {@link java.util.HashSet} per Subscriber to remember

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same below

* <p>
* <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/distinct.png" alt="">
* <p>
* It is recommended the elements' class {@code T} in the flow overrides the default {@code Object.equals()} to provide
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we use HashSet internally, we should probably recommend properly overriding hasCode() as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same below

@akarnokd akarnokd merged commit 363f038 into ReactiveX:2.x Feb 3, 2018
@akarnokd akarnokd deleted the DistinctUntilChangedClarification branch February 3, 2018 16:29
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.

3 participants