Freigeben über


CompletableFuture.Copy Method

Definition

Returns a new CompletableFuture that is completed normally with the same value as this CompletableFuture when it completes normally.

[Android.Runtime.Register("copy", "()Ljava/util/concurrent/CompletableFuture;", "GetCopyHandler", ApiSince=31)]
public virtual Java.Util.Concurrent.ICompletionStage? Copy ();
[<Android.Runtime.Register("copy", "()Ljava/util/concurrent/CompletableFuture;", "GetCopyHandler", ApiSince=31)>]
abstract member Copy : unit -> Java.Util.Concurrent.ICompletionStage
override this.Copy : unit -> Java.Util.Concurrent.ICompletionStage

Returns

the new CompletableFuture

Attributes

Remarks

Returns a new CompletableFuture that is completed normally with the same value as this CompletableFuture when it completes normally. If this CompletableFuture completes exceptionally, then the returned CompletableFuture completes exceptionally with a CompletionException with this exception as cause. The behavior is equivalent to thenApply(x -> x). This method may be useful as a form of "defensive copying", to prevent clients from completing, while still being able to arrange dependent actions.

Added in 9.

Java documentation for java.util.concurrent.CompletableFuture.copy().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to