-
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
2.x: Add singleOrError, firstOrError, lastOrError & elementAtOrError to Observable and Flowable #4589
2.x: Add singleOrError, firstOrError, lastOrError & elementAtOrError to Observable and Flowable #4589
Conversation
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.
Great job!
@@ -104,7 +105,12 @@ public void onComplete() { | |||
s = SubscriptionHelper.CANCELLED; | |||
if (index <= count && !done) { | |||
done = true; | |||
actual.onSuccess(defaultValue); | |||
|
|||
if (defaultValue != null) { |
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.
T v = defaultValue;
if (v != null) {
actual.onSuccess(v);
} else {
@@ -96,7 +99,11 @@ public void onError(Throwable t) { | |||
public void onComplete() { | |||
if (index <= count && !done) { | |||
done = true; | |||
actual.onSuccess(defaultValue); | |||
if (defaultValue != null) { |
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.
Read into T v
There are javadoc mistakes btw. |
Yup I saw them and I'll fix them up. I didn't execute that test locally. (running all tests take forever on my local machine) |
Current coverage is 78.10% (diff: 100%)@@ 2.x #4589 diff @@
==========================================
Files 552 552
Lines 36247 36272 +25
Methods 0 0
Messages 0 0
Branches 5594 5601 +7
==========================================
+ Hits 28293 28332 +39
+ Misses 5944 5923 -21
- Partials 2010 2017 +7
|
Oh, this broke because of the error fixes. /cc @JakeWharton and @abersnaze on naming/functionality. |
…to Observable and Flowable
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.
Great job
Closes #4588