ConnectableObservable

Resembles an ordinary Observable, except that it does not begin emitting elements when it is subscribed to, but only when its Connectable.connect method is called.

Please refer to the corresponding RxJava document.

Functions

Link copied to clipboard

Returns a Completable which signals onComplete when this Observable signals onComplete.

Link copied to clipboard
fun <T> ConnectableObservable<T>.autoConnect(subscriberCount: Int = 1): Observable<T>

Returns an Observable that automatically connects (at most once) to this ConnectableObservable when the subscriberCount number of observers subscribe to it.

Link copied to clipboard
fun <T> Observable<T>.buffer(count: Int, skip: Int = count): Observable<List<T>>

Returns an Observable that emits buffered Lists of elements it collects from the source Observable. The first buffer is started with the first element emitted by the source Observable. Every subsequent buffer is started every skip elements, making overlapping buffers possible. Buffers are emitted once the size reaches count elements.

fun <T> Observable<T>.buffer(boundaries: Observable<*>, limit: Int = Int.MAX_VALUE, restartOnLimit: Boolean = false): Observable<List<T>>

Returns an Observable that emits non-overlapping windows of elements it collects from the source Observable. Window boundaries are determined by the elements emitted by the specified boundaries Observable.

fun <T, S> Observable<T>.buffer(opening: Observable<S>, closing: (S) -> Completable, limit: Int = Int.MAX_VALUE, restartOnLimit: Boolean = false): Observable<List<T>>

Returns an Observable that emits possibly overlapping windows of elements it collects from the source Observable. Every new window is opened when the opening Observable emits an element. Each window is closed when the corresponding Observable returned by the closing function completes.

fun <T> Observable<T>.buffer(span: Duration, scheduler: Scheduler, limit: Int = Int.MAX_VALUE, restartOnLimit: Boolean = false): Observable<List<T>>

Returns an Observable that emits non-overlapping windows of elements it collects from the source Observable.

fun <T> Observable<T>.buffer(span: Duration, skip: Duration, scheduler: Scheduler, limit: Int = Int.MAX_VALUE, restartOnLimit: Boolean = false): Observable<List<T>>

Returns an Observable that emits possibly overlapping windows of elements it collects from the source Observable.

Link copied to clipboard
fun <T, C> Observable<T>.collect(collectionSupplier: () -> C, accumulator: (C, T) -> Unit): Single<C>

Collects elements emitted by the finite source Observable into a mutable data structure C and returns a Single that emits this structure. The accumulator should mutate the structure adding elements into it.

Link copied to clipboard
fun <T, R> Observable<T>.concatMap(mapper: (T) -> Observable<R>): Observable<R>

Returns an Observable that applies the mapper to every element emitted by the source Observable and concatenates the returned Observables.

Link copied to clipboard
fun <T, R> Observable<T>.concatMapMaybe(mapper: (T) -> Maybe<R>): Observable<R>

Returns an Observable that applies the mapper to every element emitted by the source Observable and concatenates the returned Maybes.

Link copied to clipboard
fun <T, R> Observable<T>.concatMapSingle(mapper: (T) -> Single<R>): Observable<R>

Returns an Observable that applies the mapper to every element emitted by the source Observable and concatenates the returned Singles.

Link copied to clipboard

Concatenates both the source and the other Observables.

Link copied to clipboard

Returns an Observable that first emits all elements from the source Observable and then the provided value.

Link copied to clipboard
abstract fun connect(onConnect: (Disposable) -> Unit? = null)
Link copied to clipboard
fun <T> Observable<T>.debounce(debounceSelector: (T) -> Completable): Observable<T>

Returns an Observable that mirrors the source Observable, but drops elements that are followed by newer ones within a computed debounce duration.

fun <T> Observable<T>.debounce(timeout: Duration, scheduler: Scheduler): Observable<T>

Returns an Observable that mirrors the source Observable, but drops elements that are followed by newer ones before the timeout expires on a specified Scheduler.

Link copied to clipboard
fun <T> Observable<T>.defaultIfEmpty(defaultValue: T): Observable<T>

Returns an Observable that emits the elements emitted from the source Observable or the specified defaultValue if the source Observable is empty.

Link copied to clipboard
fun <T> Observable<T>.delay(delay: Duration, scheduler: Scheduler, delayError: Boolean = false): Observable<T>

Delays onNext and onComplete signals from the current Observable for the specified time. The onError signal is not delayed by default, which can be enabled by setting the delayError flag.

Link copied to clipboard

Delays the actual subscription to the Observable for the specified time.

Link copied to clipboard
fun <T> Observable<T>.distinctUntilChanged(comparator: (T, T) -> Boolean = ::equals): Observable<T>

Returns an Observable that emits all elements emitted by the source Observable that are distinct from their immediate predecessors when compared with each other via the provided comparator.

fun <T, R> Observable<T>.distinctUntilChanged(keySelector: (T) -> R, comparator: (R, R) -> Boolean = ::equals): Observable<T>

Returns an Observable that emits all elements emitted by the source Observable that are distinct from their immediate predecessors. Each emitted element is mapped to a key using the provided keySelector. Each pair of sibling keys is compared using the provided comparator.

Link copied to clipboard
fun <T> Observable<T>.doOnAfterComplete(action: () -> Unit): Observable<T>

Calls the action when the Observable signals onComplete. The action is called after the observer is called.

Link copied to clipboard
fun <T> Observable<T>.doOnAfterDispose(action: () -> Unit): Observable<T>

Calls the shared action when the Disposable sent to the observer via onSubscribe is disposed. The action is called after the upstream is disposed.

Link copied to clipboard

Calls the consumer with the emitted Throwable when the Observable signals onError. The consumer is called after the observer is called.

Link copied to clipboard
fun <T> Observable<T>.doOnAfterFinally(action: () -> Unit): Observable<T>

Calls the action when one of the following events occur:

Link copied to clipboard
fun <T> Observable<T>.doOnAfterNext(consumer: (T) -> Unit): Observable<T>

Calls the consumer with the emitted element when the Observable signals onNext. The consumer is called after the observer is called.

Link copied to clipboard

Calls the shared action for each new observer with the Disposable sent to the downstream. The action is called for each new observer after its onSubscribe callback is called.

Link copied to clipboard
fun <T> Observable<T>.doOnAfterTerminate(action: () -> Unit): Observable<T>

Calls the action when the Observable signals a terminal event: onComplete or onError. The action is called after the observer is called.

Link copied to clipboard
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.

Link copied to clipboard
fun <T> Observable<T>.doOnBeforeDispose(action: () -> Unit): Observable<T>

Calls the shared action when the Disposable sent to the observer via onSubscribe is disposed. The action is called before the upstream is disposed.

Link copied to clipboard

Calls the consumer with the emitted Throwable when the Observable signals onError. The consumer is called before the observer is called.

Link copied to clipboard
fun <T> Observable<T>.doOnBeforeFinally(action: () -> Unit): Observable<T>

Calls the action when one of the following events occur:

Link copied to clipboard
fun <T> Observable<T>.doOnBeforeNext(consumer: (T) -> Unit): Observable<T>

Calls the consumer with the emitted value when the Observable signals onNext. The consumer is called before the observer is called.

Link copied to clipboard

Calls the shared action for each new observer with the Disposable sent to the downstream. The action is called for each new observer before its onSubscribe callback is called.

Link copied to clipboard

Calls the action when the Observable signals a terminal event: onComplete or onError. The action is called before the observer is called.

Link copied to clipboard
fun <T> Observable<T>.filter(predicate: (T) -> Boolean): Observable<T>

Filters elements emitted by the Observable using the provided predicate.

Link copied to clipboard

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

Link copied to clipboard
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.

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.

Link copied to clipboard
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.

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.

Link copied to clipboard
fun <T, R> Observable<T>.flatMap(maxConcurrency: Int = Int.MAX_VALUE, mapper: (T) -> Observable<R>): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Observable. Emits elements from inner Observables. The maximum number of concurrently subscribed inner Observables is determined by the maxConcurrency argument.

fun <T, U, R> Observable<T>.flatMap(resultSelector: (T, U) -> R, maxConcurrency: Int = Int.MAX_VALUE, mapper: (T) -> Observable<U>): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Observable. For each element U emitted by an inner Observable, calls resultSelector with the original source element T and the inner element U, and emits the result element R. The maximum number of concurrently subscribed inner Observables is determined by the maxConcurrency argument.

Link copied to clipboard
fun <T> Observable<T>.flatMapCompletable(maxConcurrency: Int = Int.MAX_VALUE, mapper: (T) -> Completable): Completable

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Completable. The maximum number of concurrently subscribed inner Completables is determined by the maxConcurrency argument.

Link copied to clipboard
fun <T, R> Observable<T>.flatMapIterable(transformer: (T) -> Iterable<R>): Observable<R>

Calls the transformer for each element emitted by the Observable and emits all elements from the returned Iterables.

Link copied to clipboard
fun <T, R> Observable<T>.flatMapMaybe(maxConcurrency: Int = Int.MAX_VALUE, mapper: (T) -> Maybe<R>): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Maybe. Emits elements from inner Maybes. The maximum number of concurrently subscribed inner Maybes is determined by the maxConcurrency argument.

fun <T, U, R> Observable<T>.flatMapMaybe(maxConcurrency: Int = Int.MAX_VALUE, mapper: (T) -> Maybe<U>, resultSelector: (T, U) -> R): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Maybe. For an element U emitted by an inner Maybe, calls resultSelector with the original source element T and the inner element U, and emits the result element R. The maximum number of concurrently subscribed inner Maybes is determined by the maxConcurrency argument.

Link copied to clipboard
fun <T, R> Observable<T>.flatMapSingle(maxConcurrency: Int = Int.MAX_VALUE, mapper: (T) -> Single<R>): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Single. Emits elements from inner Singles. The maximum number of concurrently subscribed inner Singles is determined by the maxConcurrency argument.

fun <T, U, R> Observable<T>.flatMapSingle(maxConcurrency: Int = Int.MAX_VALUE, mapper: (T) -> Single<U>, resultSelector: (T, U) -> R): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Single. For an element U emitted by an inner Single, calls resultSelector with the original source element T and the inner element U, and emits the result element R. The maximum number of concurrently subscribed inner Singles is determined by the maxConcurrency argument.

Link copied to clipboard
@JvmName(name = "flattenMaybe")
fun <T> Observable<Maybe<T>>.flatten(): Observable<T>

Concatenates all emitted Maybes. See concatMap for more information.

@JvmName(name = "flattenObservable")
fun <T> Observable<Observable<T>>.flatten(): Observable<T>

Concatenates all emitted Observables. See concatMap for more information.

@JvmName(name = "flattenSingle")
fun <T> Observable<Single<T>>.flatten(): Observable<T>

Concatenates all emitted Singles. See concatMap for more information.

Concatenates all emitted Iterables of elements. See concatMap for more information.

Link copied to clipboard
fun <T, R> Observable<T>.map(mapper: (T) -> R): Observable<R>

Converts elements emitted by the Observable using the provided mapper and emits the result elements.

Link copied to clipboard
fun <T, R> Observable<Iterable<T>>.mapIterable(mapper: (T) -> R): Observable<List<R>>

Maps each Iterable emitted by the Observable using the provided mapper and emits Lists with the result elements. See map for more information.

Link copied to clipboard
fun <T, R, C : MutableCollection<R>> Observable<Iterable<T>>.mapIterableTo(collectionSupplier: () -> C, mapper: (T) -> R): Observable<C>

Maps each Iterable emitted by the Observable using the provided mapper into a MutableCollection returned by collectionSupplier. Emits MutableCollections with the result elements. See map for more information.

Link copied to clipboard
fun <T, R : Any> Observable<T>.mapNotNull(mapper: (T) -> R?): Observable<R>

A shortcut for map followed by notNull

Link copied to clipboard

Returns an Observable that emits only non-null elements from the source Observable.

Link copied to clipboard

Signals all events of the Observable on the specified Scheduler.

Link copied to clipboard
inline fun <T> Observable<*>.ofType(): Observable<T>

Returns an Observable that emits only elements of type T from the source Observable.

Link copied to clipboard

Returns an Observable which completes when this Observable signals onError.

Link copied to clipboard

When the Observable signals onError, resumes the flow with next Observable.

When the Observable signals onError, resumes the flow with a new Observable returned by nextSupplier.

Link copied to clipboard
fun <T> Observable<T>.onErrorReturn(valueSupplier: (Throwable) -> T): Observable<T>

When the Observable signals onError, emits a value returned by valueSupplier.

Link copied to clipboard

When the Observable signals onError, emits the value.

Link copied to clipboard

Returns a ConnectableObservable that shares a single subscription to the source Observable. The source Observable is subscribed when the ConnectableObservable.connect method is called, and is unsubscribed when the returned Disposable is disposed.

fun <T, R> Observable<T>.publish(selector: (Observable<T>) -> Observable<R>): Observable<R>

For every subscription, calls the selector with an Observable that shares a single subscription to this Observable, and emits elements from the returned Observable.

Link copied to clipboard
fun <T> Observable<T>.reduce(reducer: (a: T, b: T) -> T): Maybe<T>

Returns a Maybe that subscribes to this Observable and calls the reducer function with a result of a previous reducer invocation and a current element. The returned Maybe emits a result of the final reducer invocation, or completes if the source Observable emitted less than two elements.

Link copied to clipboard
fun <T> ConnectableObservable<T>.refCount(subscriberCount: Int = 1): Observable<T>

Returns an Observable that connects to this ConnectableObservable when the number of active subscribers reaches subscriberCount and disconnects when all subscribers have unsubscribed.

Link copied to clipboard
fun <T> Observable<T>.repeat(times: Long = Long.MAX_VALUE): Observable<T>

Returns an Observable that repeats the sequence of this Observable at most times times.

Link copied to clipboard
fun <T> Observable<T>.repeatUntil(predicate: () -> Boolean): Observable<T>

Returns an Observable that calls the predicate when this Observable completes and resubscribes to this Observable if the predicate returned false.

Link copied to clipboard
fun <T> Observable<T>.repeatWhen(handler: (attempt: Int) -> Maybe<*>): Observable<T>

Returns an Observable that calls the handler when this Observable completes, subscribes to the returned Maybe, and resubscribes to this Observable when the Maybe succeeds with any value. If the returned Maybe completes then the returned Observable completes as well.

Link copied to clipboard
fun <T> Observable<T>.replay(bufferSize: Int = Int.MAX_VALUE): ConnectableObservable<T>

Returns a ConnectableObservable that shares a single subscription to the source Observable and replays at most bufferSize elements emitted by the source Observable to any future subscriber.

Link copied to clipboard
fun <T> Observable<T>.retry(predicate: (attempt: Long, Throwable) -> Boolean = { _, _ -> true }): Observable<T>

Returns an Observable that automatically resubscribes to this Observable if it signals onError and the predicate returns true for that specific Throwable and attempt.

fun <T> Observable<T>.retry(times: Int): Observable<T>

Returns an Observable that automatically resubscribes to this Observable at most times times if it signals onError.

Link copied to clipboard

Returns an Observable that automatically resubscribes to this Observable if it signals onError and the Observable returned by the handler function emits a value for that specific Throwable.

Link copied to clipboard
fun <T> Observable<T>.sample(window: Duration, scheduler: Scheduler): Observable<T>

Returns an Observable that emits the most recently emitted element (if any) emitted by the source Observable within periodic time intervals.

Link copied to clipboard
fun <T> Observable<T>.scan(accumulator: (acc: T, value: T) -> T): Observable<T>

Returns an Observable that subscribes to the source Observable and calls the accumulator function with a result of a previous accumulator invocation and a current element. The returned Observable emits every value returned by the accumulator function.

fun <T, R> Observable<T>.scan(seed: R, accumulator: (acc: R, value: T) -> R): Observable<R>

Returns an Observable that subscribes to the source Observable and calls the accumulator function first with the specified seed value and a first element emitted by the source Observable. Then for every subsequent element emitted by the source Observable, calls accumulator with its previous result the emitted element. The returned Observable emits every value returned by the accumulator function.

fun <T, R> Observable<T>.scan(getSeed: () -> R, accumulator: (acc: R, value: T) -> R): Observable<R>

Returns an Observable that subscribes to the source Observable and calls the accumulator function first with a value returned by getSeed function and a first element emitted by the source Observable. Then for every subsequent element emitted by the source Observable, calls accumulator with its previous result the emitted element. The returned Observable emits every value returned by the accumulator function.

Link copied to clipboard

Returns an Observable that shares a single subscription to the source Observable.

Link copied to clipboard
fun <T> Observable<T>.skip(count: Long): Observable<T>

Returns an Observable that skips the first count elements emitted by the source Observable and emits the remainder.

Link copied to clipboard

Returns an Observable that concatenates the other and the source Observables.

Link copied to clipboard

Returns an Observable that first emits the specified value and then subscribes to the source Observable.

Link copied to clipboard
abstract fun subscribe(observer: ObservableObserver<T>)

Subscribes the specified Observer to this Source

Link copied to clipboard
fun <T> Observable<T>.subscribe(onSubscribe: (Disposable) -> Unit? = null, onError: (Throwable) -> Unit? = null, onComplete: () -> Unit? = null, onNext: (T) -> Unit? = null): Disposable

Subscribes to the Observable and provides event callbacks.

Link copied to clipboard

Returns an Observable that subscribes to the source Observable on the specified Scheduler.

Link copied to clipboard
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.

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.

Link copied to clipboard
fun <T, R> Observable<T>.switchMap(mapper: (T) -> Observable<R>): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Observable, disposing any previously subscribed inner Observable. Emits elements of a most recent inner Observable.

fun <T, U, R> Observable<T>.switchMap(mapper: (T) -> Observable<U>, resultSelector: (T, U) -> R): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Observable, disposing any previously subscribed inner Observable. For each element U emitted by a most recent inner Observable, calls resultSelector with the original source element T and the inner element U, and emits the result element R.

Link copied to clipboard

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Completable, disposing any previously subscribed inner Completable.

Link copied to clipboard
fun <T, R> Observable<T>.switchMapMaybe(mapper: (T) -> Maybe<R>): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Maybe, disposing any previously subscribed inner Maybe. Emits elements from inner Maybes.

fun <T, U, R> Observable<T>.switchMapMaybe(mapper: (T) -> Maybe<U>, resultSelector: (T, U) -> R): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Maybe, disposing any previously subscribed inner Maybe. Emits elements from inner Maybes. For an element U emitted by an inner Maybe, calls resultSelector with the original source element T and the inner element U, and emits the result element R.

Link copied to clipboard
fun <T, R> Observable<T>.switchMapSingle(mapper: (T) -> Single<R>): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Single, disposing any previously subscribed inner Single. Emits elements from inner Singles.

fun <T, U, R> Observable<T>.switchMapSingle(mapper: (T) -> Single<U>, resultSelector: (T, U) -> R): Observable<R>

Calls the mapper for each element emitted by the Observable and subscribes to the returned inner Single, disposing any previously subscribed inner Single. Emits elements from inner Singles. For an element U emitted by an inner Single, calls resultSelector with the original source element T and the inner element U, and emits the result element R.

Link copied to clipboard
fun <T> Observable<T>.take(limit: Int): Observable<T>

Emit only the first limit elements emitted by source Observable.

Link copied to clipboard

Returns an Observable that emits elements emitted by the source Observable until the other Observable emits an element.

fun <T> Observable<T>.takeUntil(predicate: (T) -> Boolean): Observable<T>

Returns an Observable that emits elements emitted by the source Observable, checks the specified predicate for each element and completes when it returned true

Link copied to clipboard
fun <T> Observable<T>.takeWhile(predicate: (T) -> Boolean): Observable<T>

Returns an Observable that checks the specified predicate for each element emitted by the source Observable, and emits the element if the predicate returned true or completes if it returned false.

Link copied to clipboard
fun <T> Observable<T>.throttle(window: Duration, scheduler: Scheduler = computationScheduler): Observable<T>

Returns an Observable that emits only the first element emitted by the source Observable during a time window defined by window, which begins with the emitted element.

Link copied to clipboard
fun <T> Observable<T>.throttleLatest(timeout: (T) -> Completable, emitLast: Boolean = false): Observable<T>

Emits a first element from the source Observable, then calls the timeout supplier and and opens a time window defined by a returned Completable. Then does not emit any elements from the source Observable while the time window is open, and only emits a most recent element when the time window closes.

fun <T> Observable<T>.throttleLatest(timeout: Duration, scheduler: Scheduler, emitLast: Boolean = false): Observable<T>

Emits a first element from the source Observable and opens a time window specified by timeout. Then does not emit any elements from the source Observable while the time window is open, and only emits a most recent element when the time window closes.

Link copied to clipboard
fun <T> Observable<T>.timeout(timeout: Duration, scheduler: Scheduler, other: Observable<T>? = null): Observable<T>

Returns an Observable that emits elements from the source Observable and counts a timeout specified by timeout. If the timeout ever hits, disposes the source Observable and subscribes to the other Observable, if any.

Link copied to clipboard

Returns a Single that emits a List containing all elements emitted by the finite source Observable.

Link copied to clipboard
fun <T, K> Observable<T>.toMap(keySelector: (T) -> K): Single<Map<K, T>>

Returns a Single that emits a Map containing all elements emitted by the finite source Observable, associated with keys returned by keySelector.

fun <T, K, V> Observable<T>.toMap(keySelector: (T) -> K, valueSelector: (T) -> V): Single<Map<K, V>>

Returns a Single that emits a Map containing all elements emitted by the finite source Observable, transformed by valueSelector and associated with keys returned by keySelector.

Link copied to clipboard
fun <T> Observable<T>.window(count: Long, skip: Long = count): Observable<Observable<T>>

Returns an Observable that emits windows of elements it collects from the source Observable.

fun <T> Observable<T>.window(boundaries: Observable<*>, limit: Long = Long.MAX_VALUE, restartOnLimit: Boolean = false): Observable<Observable<T>>

Returns an Observable that emits non-overlapping windows of elements it collects from the source Observable. Window boundaries are determined by the elements emitted by the specified boundaries Observable.

fun <T, S> Observable<T>.window(opening: Observable<S>, closing: (S) -> Completable, limit: Long = Long.MAX_VALUE, restartOnLimit: Boolean = false): Observable<Observable<T>>

Returns an Observable that emits possibly overlapping windows of elements it collects from the source Observable. Every new window is opened when the opening Observable emits an element. Each window is closed when the corresponding Observable returned by the closing function completes.

fun <T> Observable<T>.window(span: Duration, scheduler: Scheduler, limit: Long = Long.MAX_VALUE, restartOnLimit: Boolean = false): Observable<Observable<T>>

Returns an Observable that emits non-overlapping windows of elements it collects from the source Observable.

fun <T> Observable<T>.window(span: Duration, skip: Duration, scheduler: Scheduler, limit: Long = Long.MAX_VALUE, restartOnLimit: Boolean = false): Observable<Observable<T>>

Returns an Observable that emits possibly overlapping windows of elements it collects from the source Observable.

Link copied to clipboard
fun <T, U, R> Observable<T>.withLatestFrom(other: Observable<U>, mapper: (T, U) -> R): Observable<R>

Combines the elements emitted by the source Observable with a latest emitted element emitted by the other Observable. Elements are combined using the mapper function.

fun <T, U, R> Observable<T>.withLatestFrom(others: Iterable<Observable<U>>, mapper: (value: T, others: List<U>) -> R): Observable<R>

Combines the elements emitted by the source Observable with the latest emitted elements emitted by the others Observables. Elements are combined using the mapper function.

fun <T, T1, T2, R> Observable<T>.withLatestFrom(other1: Observable<T1>, other2: Observable<T2>, mapper: (value: T, other1: T1, other2: T2) -> R): Observable<R>

Combines the elements emitted by the source Observable with latest emitted elements emitted by other1 and other2 Observables. Elements are combined using the mapper function.

fun <T, T1, T2, T3, R> Observable<T>.withLatestFrom(other1: Observable<T1>, other2: Observable<T2>, other3: Observable<T3>, mapper: (value: T, other1: T1, other2: T2, other3: T3) -> R): Observable<R>

Combines the elements emitted by the source Observable with latest emitted elements emitted by other1, other2 and other3 Observables. Elements are combined using the mapper function.

Link copied to clipboard
Link copied to clipboard
fun <T, R, I> Observable<T>.zipWith(other: Observable<R>, mapper: (T, R) -> I): Observable<I>

Returns an Observable that emits elements that are the result of applying the specified mapper function to pairs of values, one each from the source Observable and another from the specified other Observable.