-
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
1.x: Single.flatMapCompletable #4226
1.x: Single.flatMapCompletable #4226
Conversation
Current coverage is 84.19% (diff: 100%)@@ 1.x #4226 diff @@
==========================================
Files 265 266 +1
Lines 17305 17335 +30
Methods 0 0
Messages 0 0
Branches 2624 2625 +1
==========================================
+ Hits 14559 14596 +37
+ Misses 1893 1887 -6
+ Partials 853 852 -1
|
The unsubscription is not properly linked, the possible exception thrown by the mapper is not handled. See this.
Yes. |
@@ -1396,6 +1396,25 @@ public R call(Object... args) { | |||
return Observable.merge(asObservable(map(func))); | |||
} | |||
|
|||
public final Completable flatMapCompletable(final Func1<? super T, ? extends Completable> func) { |
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.
javadoc
Updated the documentation. I hope the wording is okay now. Also I'm pointing to https://raw.githubusercontent.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.flatMapCompletable.png which does not exist yet but @DavidMGross already tracked it at ReactiveX/reactivex.github.io#289, I hope that's okay. thanks for the |
* @see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a> | ||
*/ | ||
public final Completable flatMapCompletable(final Func1<? super T, ? extends Completable> func) { | ||
return Completable.create(new CompletableFlatMapSingleToCompletable(this, func)); |
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.
You forgot to commit the class itself. Plus, use new CompletableFlatMapSingleToCompletable<T>(this, func)
as it is a generic class.
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.
Yup I just comitted it. Got confused since I had to stage the files individually because of the star imports ...
|
||
final Single<T> source; | ||
|
||
final Func1<? super T, Completable> mapper; |
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.
You have to change this to ? extends Completable
(and update the other places) so it compiles with the operator signature in Single
* @return the Completable returned from {@code func} when applied to the item emitted by the source Single | ||
* @see <a href="http://reactivex.io/documentation/operators/flatmap.html">ReactiveX operators documentation: FlatMap</a> | ||
*/ | ||
public final Completable flatMapCompletable(final Func1<? super T, ? extends Completable> func) { |
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.
Please tag this as @Experimental
.
👍 |
Would it be possible to get this one into 1.1.8? |
If @zsxwing or anyone from Netflix approves it in time. |
@@ -1397,6 +1397,29 @@ public R call(Object... args) { | |||
} | |||
|
|||
/** | |||
* Returns a Completable that completes based on applying a specified function to the item emitted by the |
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.
nit: {@link Completable}
👍 |
Addresses #4216
Happy to receive feedback on the implementation. Also should I take the documentation from
flatMapObservable
and adjust it?