Skip to content

Commit a1e1a25

Browse files
1.x: alias Observable.doOnCompleted to match Completable and 2x
Closes #3700.
1 parent 9f49624 commit a1e1a25

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/main/java/rx/Observable.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4453,12 +4453,31 @@ public final <U> Observable<T> distinctUntilChanged(Func1<? super T, ? extends U
44534453
* the action to invoke when the source Observable calls {@code onCompleted}
44544454
* @return the source Observable with the side-effecting behavior applied
44554455
* @see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>
4456+
* @deprecated use {@link #doOnComplete(Action0)} instead.
44564457
*/
4457-
public final Observable<T> doOnCompleted(final Action0 onCompleted) {
4458+
@Deprecated public final Observable<T> doOnCompleted(final Action0 onCompleted) {
4459+
return doOnComplete(onCompleted);
4460+
}
4461+
4462+
/**
4463+
* Modifies the source Observable so that it invokes an action when it calls {@code onCompleted}.
4464+
* <p>
4465+
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doOnCompleted.png" alt="">
4466+
* <dl>
4467+
* <dt><b>Scheduler:</b></dt>
4468+
* <dd>{@code doOnComplete} does not operate by default on a particular {@link Scheduler}.</dd>
4469+
* </dl>
4470+
*
4471+
* @param onComplete
4472+
* the action to invoke when the source Observable calls {@code onCompleted}
4473+
* @return the source Observable with the side-effecting behavior applied
4474+
* @see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>
4475+
*/
4476+
public final Observable<T> doOnComplete(final Action0 onComplete) {
44584477
Observer<T> observer = new Observer<T>() {
44594478
@Override
44604479
public final void onCompleted() {
4461-
onCompleted.call();
4480+
onComplete.call();
44624481
}
44634482

44644483
@Override

0 commit comments

Comments
 (0)