Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.jdk/scala.jdk.javaapi/FutureConverters

FutureConverters

scala.jdk.javaapi.FutureConverters

This object contains methods that convert between Scalascala.concurrent.Future and Javajava.util.concurrent.CompletionStage.

The explicit conversion methods defined here are intended to be used in Java code. For Scala code, it is recommended to use the extension methods defined inscala.jdk.FutureConverters.

Note that the bridge is implemented at the read-only side of asynchronous handles, namelyscala.concurrent.Future (instead ofscala.concurrent.Promise) andjava.util.concurrent.CompletionStage (instead ofjava.util.concurrent.CompletableFuture). This is intentional, as the semantics of bridging the write-handles would be prone to race conditions; if both ends (CompletableFuture andPromise) are completed independently at the same time, they may contain different values afterwards. For this reason,toCompletableFuture is not supported on the createdCompletionStages.

Attributes

Source
FutureConverters.scala
Graph
Supertypes
classObject
traitMatchable
classAny
Self type

Members list

Value members

Concrete methods

Returns ajava.util.concurrent.CompletionStage that will be completed with the same value or exception as the given Scalascala.concurrent.Future when that completes.

Returns ajava.util.concurrent.CompletionStage that will be completed with the same value or exception as the given Scalascala.concurrent.Future when that completes. Since the Future is a read-only representation, this CompletionStage does not support thetoCompletableFuture method.

The semantics of Scala Future demand that all callbacks are invoked asynchronously by default, therefore the returned CompletionStage routes all calls to synchronous transformations to their asynchronous counterparts, i.e.,thenRun will internally callthenRunAsync.

Value parameters

f

The Scala Future which may eventually supply the completion for the returned CompletionStage

Attributes

Returns

a CompletionStage that runs all callbacks asynchronously and does not support the CompletableFuture interface

Source
FutureConverters.scala

Returns a Scalascala.concurrent.Future that will be completed with the same value or exception as the givenjava.util.concurrent.CompletionStage when that completes.

Returns a Scalascala.concurrent.Future that will be completed with the same value or exception as the givenjava.util.concurrent.CompletionStage when that completes. Transformations of the returned Future are executed asynchronously as specified by the ExecutionContext that is given to the combinator methods.

Value parameters

cs

The CompletionStage which may eventually supply the completion for the returned Scala Future

Attributes

Returns

a Scala Future that represents the CompletionStage's completion

Source
FutureConverters.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp