From a1e1a254830d6b8cea14349b22943e606c1b8430 Mon Sep 17 00:00:00 2001 From: Zach Klippenstein Date: Fri, 12 Feb 2016 11:25:58 -0800 Subject: [PATCH] 1.x: alias Observable.doOnCompleted to match Completable and 2x Closes #3700. --- src/main/java/rx/Observable.java | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/java/rx/Observable.java b/src/main/java/rx/Observable.java index 64991569db8..2fab2ba13d4 100644 --- a/src/main/java/rx/Observable.java +++ b/src/main/java/rx/Observable.java @@ -4453,12 +4453,31 @@ public final Observable distinctUntilChanged(Func1ReactiveX operators documentation: Do + * @deprecated use {@link #doOnComplete(Action0)} instead. */ - public final Observable doOnCompleted(final Action0 onCompleted) { + @Deprecated public final Observable doOnCompleted(final Action0 onCompleted) { + return doOnComplete(onCompleted); + } + + /** + * Modifies the source Observable so that it invokes an action when it calls {@code onCompleted}. + *

+ * + *

+ *
Scheduler:
+ *
{@code doOnComplete} does not operate by default on a particular {@link Scheduler}.
+ *
+ * + * @param onComplete + * the action to invoke when the source Observable calls {@code onCompleted} + * @return the source Observable with the side-effecting behavior applied + * @see ReactiveX operators documentation: Do + */ + public final Observable doOnComplete(final Action0 onComplete) { Observer observer = new Observer() { @Override public final void onCompleted() { - onCompleted.call(); + onComplete.call(); } @Override