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

Delay with subscription and item delaying observables. #734

Merged
merged 2 commits into from
Jan 14, 2014

Conversation

akarnokd
Copy link
Member

Listed in #653

Note: onError and onCompleted events of the source are immediately propagated and will prevent emitting any pending values.

@akarnokd akarnokd mentioned this pull request Jan 10, 2014
25 tasks
@cloudbees-pull-request-builder

RxJava-pull-requests #648 SUCCESS
This pull request looks good

* fires its first onNext event.
* @return an Observable which delays the events via another Observable on a per item-basis.
*/
public <U> Observable<T> delay(Func1<? super T, ? extends Observable<U>> itemDelay) {
Copy link
Member

Choose a reason for hiding this comment

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

Do the following codes do the same thing?

    public <U> Observable<T> delay(
            final Func1<? super T, ? extends Observable<U>> itemDelay) {
        return flatMap(new Func1<T, Observable<T>>() {
            @Override
            public Observable<T> call(final T t1) {
                return itemDelay.call(t1).take(1).map(new Func1<U, T>() {
                    @Override
                    public T call(U ignored) {
                        return t1;
                    }
                });
            }
        });
    }

Copy link
Member Author

Choose a reason for hiding this comment

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

I checked Rx.NET and both onNext and onCompleted of the itemDelay's Observable trigger the value emission so this and mine is incorrect.

@cloudbees-pull-request-builder

RxJava-pull-requests #660 SUCCESS
This pull request looks good

benjchristensen added a commit that referenced this pull request Jan 14, 2014
Delay with subscription and item delaying observables.
@benjchristensen benjchristensen merged commit 22fc397 into ReactiveX:master Jan 14, 2014
@akarnokd akarnokd deleted the DelayViaObservable branch May 6, 2014 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants