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

scala.jdk.javaapi

Members list

Type members

Classlikes

This object contains methods that convert between Scala and Java collections.

This object contains methods that convert between Scala and Java collections.

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.CollectionConverters.

Note: to createJava Streams that operate on Scala collections (sequentially or in parallel), useStreamConverters.

// Java Codeimport scala.jdk.javaapi.CollectionConverters;public class A {  public void t(scala.collection.immutable.List<String> l) {    java.util.List<String> jl = CollectionConverters.asJava(l);  }}

The conversions return adapters for the corresponding API, i.e., the collections are wrapped, not converted. Changes to the original collection are reflected in the view, and vice versa.

The following conversions are supported viaasScala andasJava:

scala.collection.Iterable       <=> java.lang.Iterablescala.collection.Iterator       <=> java.util.Iteratorscala.collection.mutable.Buffer <=> java.util.Listscala.collection.mutable.Set    <=> java.util.Setscala.collection.mutable.Map    <=> java.util.Mapscala.collection.concurrent.Map <=> java.util.concurrent.ConcurrentMap

The following conversions are supported viaasScala and through specially-named methods to convert to Java collections, as shown:

scala.collection.Iterable    <=> java.util.Collection   (via asJavaCollection)scala.collection.Iterator    <=> java.util.Enumeration  (via asJavaEnumeration)scala.collection.mutable.Map <=> java.util.Dictionary   (via asJavaDictionary)

In addition, the following one-way conversions are provided viaasJava:

scala.collection.Seq         => java.util.Listscala.collection.mutable.Seq => java.util.Listscala.collection.Set         => java.util.Setscala.collection.Map         => java.util.Map

The following one way conversion is provided viaasScala:

java.util.Properties => scala.collection.mutable.Map

In all cases, converting from a source type to a target type and back again will return the original source object.

Attributes

Source
CollectionConverters.scala
Supertypes
Self type

This object contains methods that convert between Scala and Java duration types.

This object contains methods that convert between Scala and Java duration types.

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.DurationConverters.

Attributes

Source
DurationConverters.scala
Supertypes
classObject
traitMatchable
classAny
Self type

This object contains methods that convert between Scala and Java function types.

This object contains methods that convert between Scala and Java function types.

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.FunctionConverters.

For details how the function converters work, seescala.jdk.FunctionConverters.

Attributes

Source
FunctionConverters.scala
Supertypes
classObject
traitMatchable
classAny
Self type

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

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
Supertypes
classObject
traitMatchable
classAny
Self type

This object contains methods that convert between ScalaOption and JavaOptional types.

This object contains methods that convert between ScalaOption and JavaOptional types.

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.OptionConverters.

Attributes

Source
OptionConverters.scala
Supertypes
classObject
traitMatchable
classAny
Self type

This object contains methods to create Java Streams that operate on Scala collections (sequentially or in parallel).

This object contains methods to create Java Streams that operate on Scala collections (sequentially or in parallel). For more information on Java streams, consult the documentation (https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html).

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.StreamConverters.

Note: to convert between Scala collections and classic Java collections, useCollectionConverters.

For details how the stream converters work, seescala.jdk.StreamConverters.

Attributes

Source
StreamConverters.scala
Supertypes
classObject
traitMatchable
classAny
Self type
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp