Skip to content

Commit

Permalink
1.x: alias Observable.doOnCompleted to doOnComplete to match Completa…
Browse files Browse the repository at this point in the history
…ble and 2x

Closes ReactiveX#3700.
  • Loading branch information
zach-klippenstein committed Feb 12, 2016
1 parent 9f49624 commit 053a3e9
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -4453,12 +4453,31 @@ public final <U> Observable<T> distinctUntilChanged(Func1<? super T, ? extends U
* the action to invoke when the source Observable calls {@code onCompleted}
* @return the source Observable with the side-effecting behavior applied
* @see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>
* @deprecated use {@link #doOnComplete(Action0)} instead.
*/
public final Observable<T> doOnCompleted(final Action0 onCompleted) {
@Deprecated public final Observable<T> doOnCompleted(final Action0 onCompleted) {
return doOnComplete(onCompleted);
}

/**
* Modifies the source Observable so that it invokes an action when it calls {@code onCompleted}.
* <p>
* <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doOnCompleted.png" alt="">
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code doOnComplete} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
*
* @param onComplete
* the action to invoke when the source Observable calls {@code onCompleted}
* @return the source Observable with the side-effecting behavior applied
* @see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>
*/
public final Observable<T> doOnComplete(final Action0 onComplete) {
Observer<T> observer = new Observer<T>() {
@Override
public final void onCompleted() {
onCompleted.call();
onComplete.call();
}

@Override
Expand Down

0 comments on commit 053a3e9

Please sign in to comment.