All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.reactivex.rxkotlin.completable.kt Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package io.reactivex.rxkotlin

import io.reactivex.Completable
import io.reactivex.Flowable
import io.reactivex.Observable
import io.reactivex.functions.Action
import java.util.concurrent.Callable
import java.util.concurrent.Future

fun Action.toCompletable(): Completable = Completable.fromAction(this)
fun Callable.toCompletable(): Completable = Completable.fromCallable(this)
fun Future.toCompletable(): Completable = Completable.fromFuture(this)
fun (() -> Any).toCompletable(): Completable = Completable.fromCallable(this)


// EXTENSION FUNCTION OPERATORS

/**
 * Merges the emissions of a Observable. Same as calling `flatMapSingle { it }`.
 */
fun  Observable.mergeAllCompletables() = flatMapCompletable { it }

/**
 * Merges the emissions of a Flowable. Same as calling `flatMap { it }`.
 */
fun  Flowable.mergeAllCompletables() = flatMapCompletable { it }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy