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

Observable.from(empty) to emit onComplete even when 0 requested #2899

Merged
merged 1 commit into from
Apr 21, 2015

Conversation

davidmoten
Copy link
Collaborator

As per discussion in #2884, Observable.from(iterable) is preferred to emit onCompleted when iterable is empty even when nothing has been requested.

This PR adds a check on iterator.hasNext before the Producer is assigned and emits onCompleted immediately if hasNext returns false.

Includes unit test that failed on existing code base.

@davidmoten davidmoten changed the title Observable.from(empty) should emit onComplete even when 0 requested Observable.from(empty) to emit onComplete even when 0 requested Apr 21, 2015
@davidmoten
Copy link
Collaborator Author

ah erk I need to rebase

@davidmoten davidmoten force-pushed the from-iter-eager-complete branch from d80d17b to 1f5ed40 Compare April 21, 2015 01:42
@davidmoten davidmoten force-pushed the from-iter-eager-complete branch from 1f5ed40 to 1c29e7c Compare April 21, 2015 05:16
@davidmoten
Copy link
Collaborator Author

rebased now

@akarnokd
Copy link
Member

Thanks!

akarnokd added a commit that referenced this pull request Apr 21, 2015
Observable.from(empty) to emit onComplete even when 0 requested
@akarnokd akarnokd merged commit 5044a0b into ReactiveX:1.x Apr 21, 2015
@davidmoten davidmoten deleted the from-iter-eager-complete branch April 21, 2015 08:04
@benjchristensen benjchristensen mentioned this pull request Apr 30, 2015
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.

2 participants