doOnBeforeComplete

fun <T> Observable<T>.doOnBeforeComplete(action: () -> Unit): Observable<T>

Calls the action with the emitted value when the Observable signals onComplete. The action is called before the observer is called.

Please refer to the corresponding RxJava document.