<@U0ER9B4P5> our team “invented" `current()` and `...
# rx
a
@rednifre our team “invented"
current()
and
currentOrDefault()
for that
Copy code
/**
 * Emits current value and completes or completes without a value if stream has no value at the time of subscription.
 */
fun <T> Observable<T>.current() = Observable.just(Unit).withLatestFrom(this) { _, value -> value }

fun <T> Observable<T>.currentOrDefault(default: T) = this.current().defaultIfEmpty(default)
Maybe it’s even worth to add these operators to RxJava itself? cc @jw