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 concatMapEager should accept 0 for prefetch #5185

Closed
ansman opened this issue Mar 14, 2017 · 3 comments
Closed

2.x concatMapEager should accept 0 for prefetch #5185

ansman opened this issue Mar 14, 2017 · 3 comments

Comments

@ansman
Copy link
Contributor

ansman commented Mar 14, 2017

The documentation for concatMapEager states:

@param prefetch hints about the number of expected source sequence values

Which leads me to assume that the following code should work:

Observable.fromIterable(someCollection)
    .concatMapEager(this::performTask, 5, someCollection.size())

but it will fail if the collection is empty. Either the documentation should be updated to reflect that 0 is not a valid value or it should accept 0 (and perhaps set it to a default value internally).

@akarnokd
Copy link
Member

Looks like there is a missing validation there as well. PR welcome. Plus, the parameter document should read something like:

hints about the number of expected values from each inner ObservableSource

nmorioka added a commit to nmorioka/RxJava that referenced this issue Mar 15, 2017
nmorioka added a commit to nmorioka/RxJava that referenced this issue Mar 15, 2017
@akarnokd akarnokd removed the Bug label Mar 15, 2017
@akarnokd
Copy link
Member

On a second look, this is not a bug in the operator but perhaps the underdocumentation. Prefetch of 0 or negative has no meaning and if you think there won't be any value, use 1 as the prefetch amount.

@akarnokd
Copy link
Member

Closing via #5189.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants