Created
January 18, 2017 02:36
-
-
Save ian-ellis/dea2d50776b39cd6a924c471309a058e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static <T> Observable.Transformer<T, T> doOnLast(Action1<T> doOnCompleteFunc) { | |
return new Observable.Transformer<T, T>() { | |
private T lastValue; | |
@Override | |
public Observable<T> call(Observable<T> observable) { | |
return observable.doOnNext(value -> { | |
lastValue = value; | |
}).doOnCompleted(() -> { | |
doOnCompleteFunc.call(lastValue); | |
}); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment