Scala Standard Library2.13.0 < Back


# Packages

-  package root

  This is the documentation for the Scala standard library.

  This is the documentation for the Scala standard library.

  #### Package structure

  The scala package contains core types like `Int`, `Float`, `Array` or `Option` which are accessible in all Scala compilation units without explicit qualification or imports.

  Notable packages include:

  - `scala.collection` and its sub-packages contain Scala's collections framework
    - `scala.collection.immutable` - Immutable, sequential data-structures such as `Vector`, `List`, `Range`, `HashMap` or `HashSet`
    - `scala.collection.mutable` - Mutable, sequential data-structures such as `ArrayBuffer`, `StringBuilder`, `HashMap` or `HashSet`
    - `scala.collection.concurrent` - Mutable, concurrent data-structures such as `TrieMap`
  - `scala.concurrent` - Primitives for concurrent programming such as `Futures` and `Promises`
  - `scala.io` - Input and output operations
  - `scala.math` - Basic math functions and additional numeric types like `BigInt` and `BigDecimal`
  - `scala.sys` - Interaction with other processes and the operating system
  - `scala.util.matching` - Regular expressions

  Other packages exist. See the complete list on the right.

  Additional parts of the standard library are shipped as separate libraries. These include:

  - `scala.reflect` - Scala's reflection API (scala-reflect.jar)
  - `scala.xml` - XML parsing, manipulation, and serialization (scala-xml.jar)
  - `scala.collection.parallel` - Parallel collections (scala-parallel-collections.jar)
  - `scala.util.parsing` - Parser combinators (scala-parser-combinators.jar)
  - `scala.swing` - A convenient wrapper around Java's GUI framework called Swing (scala-swing.jar)

  #### Automatic imports

  Identifiers in the scala package and the `scala.Predef` object are always in scope by default.

  Some of these identifiers are type aliases provided as shortcuts to commonly used classes. For example, `List` is an alias for `scala.collection.immutable.List`.

  Other aliases refer to classes provided by the underlying platform. For example, on the JVM, `String` is an alias for `java.lang.String`.

  Definition Classes
    root
-  package scala

  Core Scala types.

  Core Scala types. They are always available without an explicit import.

  Definition Classes
    root
-  package jdk
  Definition Classes
    scala
-  package javaapi
  Definition Classes
    jdk
- CollectionConverters
- DurationConverters
- FunctionConverters
- FutureConverters
- OptionConverters
- StreamConverters

p

scala.jdk

# javaapi

#### package javaapi


Ordering

1. Alphabetic

Visibility

1. Public
2. All

### Value Members

1.  object CollectionConverters extends AsJavaConverters with AsScalaConverters

   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 in scala.jdk.CollectionConverters.

   Note: to create Java Streams that operate on Scala collections (sequentially or in parallel), use StreamConverters.

       // Java Code
       import 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 via `asScala` and `asJava`:

       scala.collection.Iterable       <=> java.lang.Iterable
       scala.collection.Iterator       <=> java.util.Iterator
       scala.collection.mutable.Buffer <=> java.util.List
       scala.collection.mutable.Set    <=> java.util.Set
       scala.collection.mutable.Map    <=> java.util.Map
       scala.collection.concurrent.Map <=> java.util.concurrent.ConcurrentMap

   The following conversions are supported via `asScala` 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 via `asJava`:

       scala.collection.Seq         => java.util.List
       scala.collection.mutable.Seq => java.util.List
       scala.collection.Set         => java.util.Set
       scala.collection.Map         => java.util.Map

   The following one way conversion is provided via `asScala`:

       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.

2.  object DurationConverters

   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 in scala.jdk.DurationConverters.

3.  object FunctionConverters

   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 in scala.jdk.FunctionConverters.

   For details how the function converters work, see scala.jdk.FunctionConverters.

4.  object FutureConverters

   This object contains methods that convert between Scala Future and Java CompletionStage.

   This object contains methods that convert between Scala Future and Java 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 in scala.jdk.FutureConverters.

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

5.  object OptionConverters

   This object contains methods that convert between Scala `Option` and Java `Optional` types.

   This object contains methods that convert between Scala `Option` and Java `Optional` 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 in scala.jdk.OptionConverters.

6.  object StreamConverters

   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 in scala.jdk.StreamConverters.

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

   For details how the stream converters work, see scala.jdk.StreamConverters.

### Ungrouped