-
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 note about NoSuchElementException to Single.zip(). #5876
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1279,6 +1279,8 @@ public static <T> Single<T> wrap(SingleSource<T> source) { | |
* value and calls a zipper function with an array of these values to return a result | ||
* to be emitted to downstream. | ||
* <p> | ||
* If the {@code Iterable} of {@link SingleSource}s is empty a {@link NoSuchElementException} error is signalled after subscription. | ||
* <p> | ||
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the | ||
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a | ||
* {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}. | ||
|
@@ -1294,7 +1296,7 @@ public static <T> Single<T> wrap(SingleSource<T> source) { | |
* </dl> | ||
* @param <T> the common value type | ||
* @param <R> the result value type | ||
* @param sources the Iterable sequence of SingleSource instances | ||
* @param sources the Iterable sequence of SingleSource instances, must not be empty | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "An empty sequence will result in an |
||
* @param zipper the function that receives an array with values from each SingleSource | ||
* and should return a value to be emitted to downstream | ||
* @return the new Single instance | ||
|
@@ -1721,6 +1723,8 @@ public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Single<R> zip( | |
* value and calls a zipper function with an array of these values to return a result | ||
* to be emitted to downstream. | ||
* <p> | ||
* If the array of {@link SingleSource}s is empty a {@link NoSuchElementException} error is signalled immediately. | ||
* <p> | ||
* Note on method signature: since Java doesn't allow creating a generic array with {@code new T[]}, the | ||
* implementation of this operator has to create an {@code Object[]} instead. Unfortunately, a | ||
* {@code Function<Integer[], R>} passed to the method would trigger a {@code ClassCastException}. | ||
|
@@ -1736,7 +1740,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Single<R> zip( | |
* </dl> | ||
* @param <T> the common value type | ||
* @param <R> the result value type | ||
* @param sources the array of SingleSource instances | ||
* @param sources the array of SingleSource instances, must not be empty | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "An empty array will result in an |
||
* @param zipper the function that receives an array with values from each SingleSource | ||
* and should return a value to be emitted to downstream | ||
* @return the new Single instance | ||
|
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 can add explanation if you think it adds value, something like:
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.
This doesn't sound good to me. Simply state the fact that empty sequence results in a NoSuchElementException.