firstOrError

fun <T> Observable<T>.firstOrError(error: Throwable = NoSuchElementException()): Single<T>

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

Please refer to the corresponding RxJava document.


fun <T> Observable<T>.firstOrError(errorSupplier: () -> Throwable): Single<T>

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

Please refer to the corresponding RxJava document.