switchIfEmpty

fun <T> Observable<T>.switchIfEmpty(otherObservable: Observable<T>): Observable<T>

Returns an Observable that emits the elements emitted by the source Observable, or the elements of the otherObservable if the source Observable is empty.

Please refer to the corresponding RxJava document.


fun <T> Observable<T>.switchIfEmpty(otherObservable: () -> Observable<T>): Observable<T>

Returns an Observable that emits the elements emitted by the source Observable, or the elements of an Observable returned by the otherObservable function if the source Observable is empty.

Please refer to the corresponding RxJava document.