-
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
Fixed the blocking/non-blocking first #520
Conversation
RxJava-pull-requests #448 SUCCESS |
RxJava-pull-requests #452 FAILURE |
This one is on the list for review... |
RxJava-pull-requests #460 SUCCESS |
The changes look good ... basically correcting misunderstandings of @headinthebox Can you weigh in on this? |
RxJava-pull-requests #492 SUCCESS |
I rebased it on the latest codes. By the way, @benjchristensen , if you have time, could you close the enhancement issues which have already finished. It's very helpful to find out what is remaining on the TODO list. |
Sorry that my comment messed up the issues. Is there some way to delete the references in other issues? |
Quick question, is it worthwhile to have an alias for take(1) that is actually longer takeFirst()? |
I'm OK to remove |
We can mark it deprecated right now if we want to remove it.
|
*/ | ||
public Observable<T> takeFirst(Func1<? super T, Boolean> predicate) { | ||
return first(predicate); | ||
return skipWhile(not(predicate)).take(1); |
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.
For this overload of takeFirst
, I suppose we should reserve it.
RxJava-pull-requests #504 SUCCESS |
Rebased it. Any further suggestion? |
RxJava-pull-requests #526 SUCCESS |
RxJava-pull-requests #564 SUCCESS |
RxJava-pull-requests #571 FAILURE |
I implemented the non-blocking single and singeOrDefault and used them to reimplement the blocking/nonblocking single, singleOrDefault, first, firstOrDefault, last, lastOrDefault. Here are the differences between these operators:
I changed |
RxJava-pull-requests #572 SUCCESS |
RxJava-pull-requests #575 SUCCESS |
|
||
private volatile T value; | ||
private volatile boolean isEmpty = true; | ||
private volatile boolean hasTooManyElemenets; |
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.
I think these don't need to be volatiles.
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.
Removed "volatile". Thanks!
RxJava-pull-requests #576 SUCCESS |
Excellent table explaining what this is all did! @DavidMGross Can you validate all of our documentation on these operators aligns with that table above? |
Fixed the blocking/non-blocking first
Thank you @zsxwing. This is a good set of fixes. |
I've looked over the Wiki docs & javadocs and both seem to be aligned with On Mon, Dec 23, 2013 at 12:51 PM, Ben Christensen
David M. Gross |
Great work. Thanks, @DavidMGross |
Fixed the blocking/non-blocking first
Hi, this PR fixed the last problem in #423.
Observable.first
in RxJava is same asObservable.FirstAsync
in Rx.Net, which is a non-blocking operator. When the source sequence is empty, it will emit anIllegalArgumentException
.Observable.takeFirst
is an alias oftake(1)
. If the source sequence is empty, it will return an empty sequence.BlockingObservable.first
in RxJava is same asObservable.First
in Rx.Net, which is a blocking operator. When the source sequence is empty, it will emit anIllegalArgumentException
.BlockingObservable.firstOrDefault
.Here I attached my test codes for Rx.Net.
The output is: