firstOrDefault

fun <T> Observable<T>.firstOrDefault(defaultValue: T): Single<T>

Returns a Single that emits only the very first element emitted by the source Observable, or defaultValue if the source Observable is empty.

Please refer to the corresponding RxJava document.


fun <T> Observable<T>.firstOrDefault(defaultValueSupplier: () -> T): Single<T>

Returns a Single that emits only the very first element emitted by the source Observable, or a value returned by defaultValueSupplier if the source Observable is empty.

Please refer to the corresponding RxJava document.