Package kotlinx.coroutines.experimental.future

Integration with JDK8 CompletableFuture (Android API level 24).

Extensions for External Classes

java.util.concurrent.CompletionStage

kotlinx.coroutines.experimental.Deferred

Functions

future

fun <T> future(
    context: CoroutineContext = DefaultDispatcher,
    start: CoroutineStart = CoroutineStart.DEFAULT,
    parent: Job? = null,
    block: suspend CoroutineScope.() -> T
): CompletableFuture<T>

Starts new coroutine and returns its result as an implementation of CompletableFuture. This coroutine builder uses CommonPool context by default and is conceptually similar to CompletableFuture.supplyAsync.