Scala Standard Library2.13.17 < 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 annotation
  Definition Classes
    scala
-  package beans
  Definition Classes
    scala
-  package collection
  Definition Classes
    scala
-  package compat
  Definition Classes
    scala
-  package concurrent

  This package object contains primitives for concurrent and parallel programming.

  This package object contains primitives for concurrent and parallel programming.

  #### Guide

  A more detailed guide to Futures and Promises, including discussion and examples can be found at https://docs.scala-lang.org/overviews/core/futures.html.

  #### Common Imports

  When working with Futures, you will often find that importing the whole concurrent package is convenient:

      import scala.concurrent._

  When using things like `Future`s, it is often required to have an implicit `ExecutionContext` in scope. The general advice for these implicits are as follows.

  If the code in question is a class or method definition, and no `ExecutionContext` is available, request one from the caller by adding an implicit parameter list:

      def myMethod(myParam: MyType)(implicit ec: ExecutionContext) = …
      //Or
      class MyClass(myParam: MyType)(implicit ec: ExecutionContext) { … }

  This allows the caller of the method, or creator of the instance of the class, to decide which `ExecutionContext` should be used.

  For typical REPL usage and experimentation, importing the global `ExecutionContext` is often desired.

      import scala.concurrent.ExcutionContext.Implicits.global

  #### Specifying Durations

  Operations often require a duration to be specified. A duration DSL is available to make defining these easier:

      import scala.concurrent.duration._
      val d: Duration = 10.seconds

  #### Using Futures For Non-blocking Computation

  Basic use of futures is easy with the factory method on Future, which executes a provided function asynchronously, handing you back a future result of that function without blocking the current thread. In order to create the Future you will need either an implicit or explicit ExecutionContext to be provided:

      import scala.concurrent._
      import ExecutionContext.Implicits.global  // implicit execution context

      val firstZebra: Future[Int] = Future {
        val words = Files.readAllLines("/etc/dictionaries-common/words").asScala
        words.indexOfSlice("zebra")
      }

  #### Avoid Blocking

  Although blocking is possible in order to await results (with a mandatory timeout duration):

      import scala.concurrent.duration._
      Await.result(firstZebra, 10.seconds)

  and although this is sometimes necessary to do, in particular for testing purposes, blocking in general is discouraged when working with Futures and concurrency in order to avoid potential deadlocks and improve performance. Instead, use callbacks or combinators to remain in the future domain:

      val animalRange: Future[Int] = for {
        aardvark <- firstAardvark
        zebra <- firstZebra
      } yield zebra - aardvark

      animalRange.onSuccess {
        case x if x > 500000 => println("It's a long way from Aardvark to Zebra")
      }

  Definition Classes
    scala
-  package io
  Definition Classes
    scala
-  package jdk

  The jdk package contains utilities to interact with JDK classes.

  The jdk package contains utilities to interact with JDK classes.

  This packages offers a number of converters, that are able to wrap or copy types from the scala library to equivalent types in the JDK class library and vice versa:

  - CollectionConverters, converting collections like scala.collection.Seq, scala.collection.Map, scala.collection.Set, scala.collection.mutable.Buffer, scala.collection.Iterator and scala.collection.Iterable to their JDK counterparts
  - OptionConverters, converting between Option and java.util.Optional and primitive variations
  - StreamConverters, to create JDK Streams from scala collections
  - DurationConverters, for conversions between scala scala.concurrent.duration.FiniteDuration and java.time.Duration
  - FunctionConverters, from scala Functions to java java.util.function.Function, java.util.function.UnaryOperator, java.util.function.Consumer and java.util.function.Predicate, as well as primitive variations and Bi-variations.

  By convention, converters that wrap an object to provide a different interface to the same underlying data structure use .asScala and .asJava extension methods, whereas converters that copy the underlying data structure use .toScala and .toJava.

  In the javaapi package, the same converters can be found with a java-friendly interface that don't rely on implicit enrichments.

  Additionally, this package offers Accumulators, capable of efficiently traversing JDK Streams.

  Definition Classes
    scala
-  package math

  The package object `scala.math` contains methods for performing basic numeric operations such as elementary exponential, logarithmic, root and trigonometric functions.

  The package object `scala.math` contains methods for performing basic numeric operations such as elementary exponential, logarithmic, root and trigonometric functions.

  All methods forward to java.lang.Math unless otherwise noted.

  Definition Classes
    scala
  See also

    java.lang.Math

-  package ref
  Definition Classes
    scala
-  package reflect
  Definition Classes
    scala
-  package sys

  The package object `scala.sys` contains methods for reading and altering core aspects of the virtual machine as well as the world outside of it.

  The package object `scala.sys` contains methods for reading and altering core aspects of the virtual machine as well as the world outside of it.

  Definition Classes
    scala
-  package util
  Definition Classes
    scala
- #::
- <:<
- =:=
- Any
- AnyVal
- App
- Array
- Boolean
- Byte
- Char
- Console
- DelayedInit
- Double
- DummyImplicit
- Dynamic
- Enumeration
- Equals
- Float
- Function
- Function0
- Function1
- Function10
- Function11
- Function12
- Function13
- Function14
- Function15
- Function16
- Function17
- Function18
- Function19
- Function2
- Function20
- Function21
- Function22
- Function3
- Function4
- Function5
- Function6
- Function7
- Function8
- Function9
- Int
- Long
- MatchError
- None
- NotImplementedError
- Nothing
- Null
- Option
- PartialFunction
- Predef
- Product
- Product1
- Product10
- Product11
- Product12
- Product13
- Product14
- Product15
- Product16
- Product17
- Product18
- Product19
- Product2
- Product20
- Product21
- Product22
- Product3
- Product4
- Product5
- Product6
- Product7
- Product8
- Product9
- Proxy
- ScalaReflectionException
- SerialVersionUID
- Short
- Singleton
- Some
- Specializable
- StringContext
- Symbol
- Tuple1
- Tuple10
- Tuple11
- Tuple12
- Tuple13
- Tuple14
- Tuple15
- Tuple16
- Tuple17
- Tuple18
- Tuple19
- Tuple2
- Tuple20
- Tuple21
- Tuple22
- Tuple3
- Tuple4
- Tuple5
- Tuple6
- Tuple7
- Tuple8
- Tuple9
- UninitializedError
- UninitializedFieldError
- Unit
- ValueOf
- deprecated
- deprecatedInheritance
- deprecatedName
- deprecatedOverriding
- inline
- language
- languageFeature
- native
- noinline
- specialized
- throws
- transient
- unchecked
- volatile

o

scala

# None

###

#### case object None extends Option[Nothing] with Product with Serializable

This case object represents non-existent values.

Annotations
  @SerialVersionUID()
Source
  Option.scala

Linear Supertypes
Option[Nothing], java.io.Serializable, Product, Equals, collection.IterableOnce[Nothing], AnyRef, Any

Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. None
2. Option
3. Serializable
4. Product
5. Equals
6. IterableOnce
7. AnyRef
8. Any

1. Hide All
2. Show All

Visibility

1. Public
2. Protected

### Type Members

1.  class WithFilter extends AnyRef

   We need a whole WithFilter class to honor the "doesn't create a new collection" contract even though it seems unlikely to matter much in a collection with max size 1.

   We need a whole WithFilter class to honor the "doesn't create a new collection" contract even though it seems unlikely to matter much in a collection with max size 1.

   Definition Classes
     Option

### Value Members

1.  final def !=(arg0: Any): Boolean

   Test two objects for inequality.

   Test two objects for inequality.

   returns

     `true` if !(this == that), false otherwise.

   Definition Classes
     AnyRef → Any
2.  final def ##: Int

   Equivalent to `x.hashCode` except for boxed numeric types and `null`.

   Equivalent to `x.hashCode` except for boxed numeric types and `null`. For numerics, it returns a hash value which is consistent with value equality: if two value type instances compare as true, then ## will produce the same hash value for each of them. For `null` returns a hashcode where `null.hashCode` throws a `NullPointerException`.

   returns

     a hash value consistent with ==

   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean

   The expression `x == that` is equivalent to `if (x eq null) that eq null else x.equals(that)`.

   The expression `x == that` is equivalent to `if (x eq null) that eq null else x.equals(that)`.

   returns

     `true` if the receiver object is equivalent to the argument; `false` otherwise.

   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0

   Forces the compiler to treat the receiver object as having type `T0`, even though doing so may violate type safety.

   Forces the compiler to treat the receiver object as having type `T0`, even though doing so may violate type safety.

   This method is useful when you believe you have type information the compiler doesn't, and it also isn't possible to check the type at runtime. In such situations, skipping type safety is the only option.

   It is platform dependent whether `asInstanceOf` has any effect at runtime. It might do a runtime type test on the erasure of `T0`, insert a conversion (such as boxing/unboxing), fill in a default value, or do nothing at all.

   In particular, `asInstanceOf` is not a type test. It does **not** mean:

       this match {
        case x: T0 => x
        case _     => throw ClassCastException("...")

   Use pattern matching or isInstanceOf for type testing instead.

   Situations where `asInstanceOf` is useful:

   - when flow analysis fails to deduce `T0` automatically
   - when down-casting a type parameter or an abstract type member (which cannot be checked at runtime due to type erasure) If there is any doubt and you are able to type test instead, you should do so.

   Be careful of using `asInstanceOf` when `T0` is a primitive type. When `T0` is primitive, `asInstanceOf` may insert a conversion instead of a type test. If your intent is to convert, use a `toT` method (`x.toChar`, `x.toByte`, etc.).

   returns

     the receiver object.

   Definition Classes
     Any
   Exceptions thrown

     `ClassCastException` if the receiver is not an instance of the erasure of `T0`, if that can be checked on this platform

5.  def clone(): AnyRef

   Create a copy of the receiver object.

   Create a copy of the receiver object.

   The default implementation of the `clone` method is platform dependent.

   returns

     a copy of the receiver object.

   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws(classOf[java.lang.CloneNotSupportedException]) @native()
   Note

     not specified by SLS as a member of AnyRef

6.  final def collect[B](pf: PartialFunction[Nothing, B]): Option[B]

   Returns a scala.Some containing the result of applying `pf` to this scala.Option's contained value, if this option is nonempty and `pf` is defined for that value.

   Returns a scala.Some containing the result of applying `pf` to this scala.Option's contained value, if this option is nonempty and `pf` is defined for that value. Returns `None` otherwise.

   pf

     the partial function.

   returns

     the result of applying `pf` to this scala.Option's value (if possible), or `None`.

   Definition Classes
     Option
   Annotations
     @inline()
   Example:

   1.     // Returns Some(HTTP) because the partial function covers the case.
          Some("http") collect {case "http" => "HTTP"}

          // Returns None because the partial function doesn't cover the case.
          Some("ftp") collect {case "http" => "HTTP"}

          // Returns None because the option is empty. There is no value to pass to the partial function.
          None collect {case value => value}

7.  final def contains[A1 >: Nothing](elem: A1): Boolean

   Tests whether the option contains a given value as an element.

   Tests whether the option contains a given value as an element.

   This is equivalent to:

       option match {
         case Some(x) => x == elem
         case None    => false
       }

   elem

     the element to test.

   returns

     `true` if the option has an element that is equal (as determined by `==`) to `elem`, `false` otherwise.

   Definition Classes
     Option
   Example:

   1.     // Returns true because Some instance contains string "something" which equals "something".
          Some("something") contains "something"

          // Returns false because "something" != "anything".
          Some("something") contains "anything"

          // Returns false when method called on None.
          None contains "anything"

8.  final def eq(arg0: AnyRef): Boolean

   Tests whether the argument (`that`) is a reference to the receiver object (`this`).

   Tests whether the argument (`that`) is a reference to the receiver object (`this`).

   The `eq` method implements an equivalence relation on non-null instances of `AnyRef`, and has three additional properties:

   - It is consistent: for any non-null instances `x` and `y` of type `AnyRef`, multiple invocations of `x.eq(y)` consistently returns `true` or consistently returns `false`.
   - For any non-null instance `x` of type `AnyRef`, `x.eq(null)` and `null.eq(x)` returns `false`.
   - `null.eq(null)` returns `true`.

   When overriding the `equals` or `hashCode` methods, it is important to ensure that their behavior is consistent with reference equality. Therefore, if two objects are references to each other (`o1 eq o2`), they should be equal to each other (`o1 == o2`) and they should hash to the same value (`o1.hashCode == o2.hashCode`).

   returns

     `true` if the argument is a reference to the receiver object; `false` otherwise.

   Definition Classes
     AnyRef
9.  def equals(arg0: AnyRef): Boolean

   The equality method for reference types.

   The equality method for reference types. Default implementation delegates to `eq`.

   See also `equals` in scala.Any.

   returns

     `true` if the receiver object is equivalent to the argument; `false` otherwise.

   Definition Classes
     AnyRef → Any
10.  final def exists(p: (Nothing) => Boolean): Boolean

    Returns true if this option is nonempty and the predicate `p` returns true when applied to this scala.Option's value.

    Returns true if this option is nonempty and the predicate `p` returns true when applied to this scala.Option's value. Otherwise, returns false.

    This is equivalent to:

        option match {
          case Some(x) => p(x)
          case None    => false
        }

    p

      the predicate to test

    Definition Classes
      Option
    Annotations
      @inline()
11.  final def filter(p: (Nothing) => Boolean): Option[Nothing]

    Returns this scala.Option if it is nonempty and applying the predicate `p` to this scala.Option's value returns true.

    Returns this scala.Option if it is nonempty and applying the predicate `p` to this scala.Option's value returns true. Otherwise, return `None`.

    This is equivalent to:

        option match {
          case Some(x) if p(x) => Some(x)
          case _               => None
        }

    p

      the predicate used for testing.

    Definition Classes
      Option
    Annotations
      @inline()
12.  final def filterNot(p: (Nothing) => Boolean): Option[Nothing]

    Returns this scala.Option if it is nonempty and applying the predicate `p` to this scala.Option's value returns false.

    Returns this scala.Option if it is nonempty and applying the predicate `p` to this scala.Option's value returns false. Otherwise, return `None`.

    This is equivalent to:

        option match {
          case Some(x) if !p(x) => Some(x)
          case _                => None
        }

    p

      the predicate used for testing.

    Definition Classes
      Option
    Annotations
      @inline()
13.  def finalize(): Unit

    Called by the garbage collector on the receiver object when there are no more references to the object.

    Called by the garbage collector on the receiver object when there are no more references to the object.

    The details of when and if the `finalize` method is invoked, as well as the interaction between `finalize` and non-local returns and exceptions, are all platform dependent.

    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.Throwable])
    Note

      not specified by SLS as a member of AnyRef

14.  final def flatMap[B](f: (Nothing) => Option[B]): Option[B]

    Returns the result of applying `f` to this scala.Option's value if this scala.Option is nonempty.

    Returns the result of applying `f` to this scala.Option's value if this scala.Option is nonempty. Returns `None` if this scala.Option is empty. Slightly different from `map` in that `f` is expected to return an scala.Option (which could be `None`).

    This is equivalent to:

        option match {
          case Some(x) => f(x)
          case None    => None
        }

    f

      the function to apply

    Definition Classes
      Option
    Annotations
      @inline()
    See also

      map

      foreach

15.  def flatten[B](implicit ev: <:<[Nothing, Option[B]]): Option[B]

    Returns the nested scala.Option value if it is nonempty.

    Returns the nested scala.Option value if it is nonempty. Otherwise, return `None`.

    This is equivalent to:

        option match {
          case Some(Some(b)) => Some(b)
          case _             => None
        }

    ev

      an implicit conversion that asserts that the value is also an scala.Option.

    Definition Classes
      Option
    Example:

    1.     Some(Some("something")).flatten

    See also

      flatMap

16.  final def fold[B](ifEmpty: => B)(f: (Nothing) => B): B

    Returns the result of applying `f` to this scala.Option's value if the scala.Option is nonempty.

    Returns the result of applying `f` to this scala.Option's value if the scala.Option is nonempty. Otherwise, evaluates expression `ifEmpty`.

    This is equivalent to:

        option match {
          case Some(x) => f(x)
          case None    => ifEmpty
        }

    This is also equivalent to:

        option.map(f).getOrElse(ifEmpty)

    ifEmpty

      the expression to evaluate if empty.

    f

      the function to apply if nonempty.

    Definition Classes
      Option
    Annotations
      @inline()
17.  final def forall(p: (Nothing) => Boolean): Boolean

    Returns true if this option is empty or the predicate `p` returns true when applied to this scala.Option's value.

    Returns true if this option is empty or the predicate `p` returns true when applied to this scala.Option's value.

    This is equivalent to:

        option match {
          case Some(x) => p(x)
          case None    => true
        }

    p

      the predicate to test

    Definition Classes
      Option
    Annotations
      @inline()
18.  final def foreach[U](f: (Nothing) => U): Unit

    Apply the given procedure `f` to the option's value, if it is nonempty.

    Apply the given procedure `f` to the option's value, if it is nonempty. Otherwise, do nothing.

    This is equivalent to:

        option match {
          case Some(x) => f(x)
          case None    => ()
        }

    f

      the procedure to apply.

    Definition Classes
      Option
    Annotations
      @inline()
    See also

      map

      flatMap

19.  def get: Nothing

    Returns the option's value.

    Returns the option's value.

    This is equivalent to:

        option match {
          case Some(x) => x
          case None    => throw new Exception
        }

    Definition Classes
      None → Option
    Exceptions thrown

      `NoSuchElementException` if the option is empty.

    Note

      The option must be nonempty.

20.  final def getClass(): Class[_ <: AnyRef]

    Returns the runtime class representation of the object.

    Returns the runtime class representation of the object.

    returns

      a class object corresponding to the runtime type of the receiver.

    Definition Classes
      AnyRef → Any
    Annotations
      @native()
21.  final def getOrElse[B >: Nothing](default: => B): B

    Returns the option's value if the option is nonempty, otherwise return the result of evaluating `default`.

    Returns the option's value if the option is nonempty, otherwise return the result of evaluating `default`.

    This is equivalent to:

        option match {
          case Some(x) => x
          case None    => default
        }

    default

      the default expression.

    Definition Classes
      Option
    Annotations
      @inline()
22.  final def isDefined: Boolean

    Returns true if the option is an instance of scala.Some, false otherwise.

    Returns true if the option is an instance of scala.Some, false otherwise.

    This is equivalent to:

        option match {
          case Some(_) => true
          case None    => false
        }

    Definition Classes
      Option
23.  final def isEmpty: Boolean

    Returns true if the option is `None`, false otherwise.

    Returns true if the option is `None`, false otherwise.

    This is equivalent to:

        option match {
          case Some(_) => false
          case None    => true
        }

    Definition Classes
      Option
24.  final def isInstanceOf[T0]: Boolean

    Test whether the dynamic type of the receiver object has the same erasure as `T0`.

    Test whether the dynamic type of the receiver object has the same erasure as `T0`.

    Depending on what `T0` is, the test is done in one of the below ways:

    - `T0` is a non-parameterized class type, e.g. `BigDecimal`: this method returns `true` if the value of the receiver object is a `BigDecimal` or a subtype of `BigDecimal`.
    - `T0` is a parameterized class type, e.g. `List[Int]`: this method returns `true` if the value of the receiver object is some `List[X]` for any `X`. For example, `List(1, 2, 3).isInstanceOf[List[String]]` will return true.
    - `T0` is some singleton type `x.type` or literal `x`: this method returns `this.eq(x)`. For example, `x.isInstanceOf[1]` is equivalent to `x.eq(1)`
    - `T0` is an intersection `X with Y` or `X & Y: this method is equivalent to` x.isInstanceOf[X] && x.isInstanceOf[Y]``
    - `T0` is a union `X | Y`: this method is equivalent to `x.isInstanceOf[X] || x.isInstanceOf[Y]`
    - `T0` is a type parameter or an abstract type member: this method is equivalent to `isInstanceOf[U]` where `U` is `T0`'s upper bound, `Any` if `T0` is unbounded. For example, `x.isInstanceOf[A]` where `A` is an unbounded type parameter will return true for any value of `x`.

    This is exactly equivalent to the type pattern `_: T0`

    returns

      `true` if the receiver object is an instance of erasure of type `T0`; `false` otherwise.

    Definition Classes
      Any
    Note

      due to the unexpectedness of `List(1, 2, 3).isInstanceOf[List[String]]` returning true and `x.isInstanceOf[A]` where `A` is a type parameter or abstract member returning true, these forms issue a warning.

25.  def iterator: Iterator[Nothing]

    Returns a singleton iterator returning the scala.Option's value if it is nonempty, or an empty iterator if the option is empty.

    Returns a singleton iterator returning the scala.Option's value if it is nonempty, or an empty iterator if the option is empty.

    Definition Classes
      Option → IterableOnce
26.  final def knownSize: Int

    The number of elements in this option, if it can be cheaply computed, -1 otherwise.

    The number of elements in this option, if it can be cheaply computed, -1 otherwise. Cheaply usually means: Not requiring a collection traversal.

    Definition Classes
      Option → IterableOnce
27.  final def map[B](f: (Nothing) => B): Option[B]

    Returns a scala.Some containing the result of applying `f` to this scala.Option's value if this scala.Option is nonempty.

    Returns a scala.Some containing the result of applying `f` to this scala.Option's value if this scala.Option is nonempty. Otherwise return `None`.

    This is equivalent to:

        option match {
          case Some(x) => Some(f(x))
          case None    => None
        }

    f

      the function to apply

    Definition Classes
      Option
    Annotations
      @inline()
    Note

      This is similar to `flatMap` except here, `f` does not need to wrap its result in an scala.Option.

    See also

      flatMap

      foreach

28.  final def ne(arg0: AnyRef): Boolean

    Equivalent to `!(this eq that)`.

    Equivalent to `!(this eq that)`.

    returns

      `true` if the argument is not a reference to the receiver object; `false` otherwise.

    Definition Classes
      AnyRef
29.  final def nonEmpty: Boolean

    Returns false if the option is `None`, true otherwise.

    Returns false if the option is `None`, true otherwise.

    This is equivalent to:

        option match {
          case Some(_) => true
          case None    => false
        }

    Definition Classes
      Option
    Note

      Implemented here to avoid the implicit conversion to Iterable.

30.  final def notify(): Unit

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Wakes up a single thread that is waiting on the receiver object's monitor.

    Definition Classes
      AnyRef
    Annotations
      @native()
    Note

      not specified by SLS as a member of AnyRef

31.  final def notifyAll(): Unit

    Wakes up all threads that are waiting on the receiver object's monitor.

    Wakes up all threads that are waiting on the receiver object's monitor.

    Definition Classes
      AnyRef
    Annotations
      @native()
    Note

      not specified by SLS as a member of AnyRef

32.  final def orElse[B >: Nothing](alternative: => Option[B]): Option[B]

    Returns this scala.Option if it is nonempty, otherwise return the result of evaluating `alternative`.

    Returns this scala.Option if it is nonempty, otherwise return the result of evaluating `alternative`.

    This is equivalent to:

        option match {
          case Some(x) => Some(x)
          case None    => alternative
        }

    alternative

      the alternative expression.

    Definition Classes
      Option
    Annotations
      @inline()
33.  final def orNull[A1 >: Nothing](implicit ev: <:<[Null, A1]): A1

    Returns the option's value if it is nonempty, or `null` if it is empty.

    Returns the option's value if it is nonempty, or `null` if it is empty.

    Although the use of null is discouraged, code written to use scala.Option must often interface with code that expects and returns nulls.

    This is equivalent to:

        option match {
          case Some(x) => x
          case None    => null
        }

    Definition Classes
      Option
    Annotations
      @inline()
    Example:

    1.     val initialText: Option[String] = getInitialText
           val textField = new JComponent(initialText.orNull,20)

34.  def productElementName(n: Int): String

    The name of the nth element of this product, 0-based.

    The name of the nth element of this product, 0-based. In the default implementation, an empty string.

    n

      the index of the element name to return

    returns

      the name of the specified element

    Definition Classes
      Product
    Exceptions thrown

      `IndexOutOfBoundsException` if the `n` is out of range(n < 0 || n >= productArity).

35.  def productElementNames: Iterator[String]

    An iterator over the names of all the elements of this product.

    An iterator over the names of all the elements of this product.

    Definition Classes
      Product
36.  def stepper[S <: Stepper[_]](implicit shape: StepperShape[Nothing, S]): S

    Returns a scala.collection.Stepper for the elements of this collection.

    Returns a scala.collection.Stepper for the elements of this collection.

    The Stepper enables creating a Java stream to operate on the collection, see scala.jdk.StreamConverters. For collections holding primitive values, the Stepper can be used as an iterator which doesn't box the elements.

    The implicit scala.collection.StepperShape parameter defines the resulting Stepper type according to the element type of this collection.

    - For collections of `Int`, `Short`, `Byte` or `Char`, an scala.collection.IntStepper is returned
    - For collections of `Double` or `Float`, a scala.collection.DoubleStepper is returned
    - For collections of `Long` a scala.collection.LongStepper is returned
    - For any other element type, an scala.collection.AnyStepper is returned

    Note that this method is overridden in subclasses and the return type is refined to `S with EfficientSplit`, for example scala.collection.IndexedSeqOps.stepper. For Steppers marked with scala.collection.Stepper.EfficientSplit, the converters in scala.jdk.StreamConverters allow creating parallel streams, whereas bare Steppers can be converted only to sequential streams.

    Definition Classes
      IterableOnce
37.  final def synchronized[T0](arg0: => T0): T0

    Executes the code in `body` with an exclusive lock on `this`.

    Executes the code in `body` with an exclusive lock on `this`.

    returns

      the result of `body`

    Definition Classes
      AnyRef
38.  final def toLeft[X](right: => X): Either[Nothing, X]

    Returns a scala.util.Right containing the given argument `right` if this is empty, or a scala.util.Left containing this scala.Option's value if this scala.Option is nonempty.

    Returns a scala.util.Right containing the given argument `right` if this is empty, or a scala.util.Left containing this scala.Option's value if this scala.Option is nonempty.

    This is equivalent to:

        option match {
          case Some(x) => Left(x)
          case None    => Right(right)
        }

    right

      the expression to evaluate and return if this is empty

    Definition Classes
      Option
    Annotations
      @inline()
    See also

      toRight

39.  def toList: List[Nothing]

    Returns a singleton list containing the scala.Option's value if it is nonempty, or the empty list if the scala.Option is empty.

    Returns a singleton list containing the scala.Option's value if it is nonempty, or the empty list if the scala.Option is empty.

    This is equivalent to:

        option match {
          case Some(x) => List(x)
          case None    => Nil
        }

    Definition Classes
      Option
40.  final def toRight[X](left: => X): Either[X, Nothing]

    Returns a scala.util.Left containing the given argument `left` if this scala.Option is empty, or a scala.util.Right containing this scala.Option's value if this is nonempty.

    Returns a scala.util.Left containing the given argument `left` if this scala.Option is empty, or a scala.util.Right containing this scala.Option's value if this is nonempty.

    This is equivalent to:

        option match {
          case Some(x) => Right(x)
          case None    => Left(left)
        }

    left

      the expression to evaluate and return if this is empty

    Definition Classes
      Option
    Annotations
      @inline()
    See also

      toLeft

41.  final def unzip[A1, A2](implicit asPair: <:<[Nothing, (A1, A2)]): (Option[A1], Option[A2])

    Converts an Option of a pair into an Option of the first element and an Option of the second element.

    Converts an Option of a pair into an Option of the first element and an Option of the second element.

    This is equivalent to:

        option match {
          case Some((x, y)) => (Some(x), Some(y))
          case _            => (None,    None)
        }

    A1

      the type of the first half of the element pair

    A2

      the type of the second half of the element pair

    asPair

      an implicit conversion which asserts that the element type of this Option is a pair.

    returns

      a pair of Options, containing, respectively, the first and second half of the element pair of this Option.

    Definition Classes
      Option
42.  final def unzip3[A1, A2, A3](implicit asTriple: <:<[Nothing, (A1, A2, A3)]): (Option[A1], Option[A2], Option[A3])

    Converts an Option of a triple into three Options, one containing the element from each position of the triple.

    Converts an Option of a triple into three Options, one containing the element from each position of the triple.

    This is equivalent to:

        option match {
          case Some((x, y, z)) => (Some(x), Some(y), Some(z))
          case _               => (None,    None,    None)
        }

    A1

      the type of the first of three elements in the triple

    A2

      the type of the second of three elements in the triple

    A3

      the type of the third of three elements in the triple

    asTriple

      an implicit conversion which asserts that the element type of this Option is a triple.

    returns

      a triple of Options, containing, respectively, the first, second, and third elements from the element triple of this Option.

    Definition Classes
      Option
43.  final def wait(): Unit

    See https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--.

    See https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--.

    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
    Note

      not specified by SLS as a member of AnyRef

44.  final def wait(arg0: Long, arg1: Int): Unit

    See https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-

    See https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-

    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
    Note

      not specified by SLS as a member of AnyRef

45.  final def wait(arg0: Long): Unit

    See https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-.

    See https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-.

    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException]) @native()
    Note

      not specified by SLS as a member of AnyRef

46.  final def withFilter(p: (Nothing) => Boolean): WithFilter

    Necessary to keep scala.Option from being implicitly converted to scala.collection.Iterable in `for` comprehensions.

    Necessary to keep scala.Option from being implicitly converted to scala.collection.Iterable in `for` comprehensions.

    Definition Classes
      Option
    Annotations
      @inline()
47.  final def zip[A1 >: Nothing, B](that: Option[B]): Option[(A1, B)]

    Returns a scala.Some formed from this option and another option by combining the corresponding elements in a pair.

    Returns a scala.Some formed from this option and another option by combining the corresponding elements in a pair. If either of the two options is empty, `None` is returned.

    This is equivalent to:

        (option1, option2) match {
          case (Some(x), Some(y)) => Some((x, y))
          case _                  => None
        }

    that

      the options which is going to be zipped

    Definition Classes
      Option
    Example:

    1.     // Returns Some(("foo", "bar")) because both options are nonempty.
           Some("foo") zip Some("bar")

           // Returns None because `that` option is empty.
           Some("foo") zip None

           // Returns None because `this` option is empty.
           None zip Some("bar")

### Inherited from Option[Nothing]

### Inherited from java.io.Serializable

### Inherited from Product

### Inherited from Equals

### Inherited from collection.IterableOnce[Nothing]

### Inherited from AnyRef

### Inherited from Any

### Ungrouped