completeWith

fun <T> CompletableDeferred<T>.completeWith(result: Result<T>): Boolean

Completes this deferred value with the value or exception in the given result. Returns true if this deferred was completed as a result of this invocation and false otherwise (if it was already completed).

Subsequent invocations of this function have no effect and always produce false.

This function transitions this deferred in the same ways described by CompletableDeferred.complete and CompletableDeferred.completeExceptionally.

Sources

common source
Link copied to clipboard