Scala Standard Library2.13.5 < 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

# Predef

###

#### object Predef extends LowPriorityImplicits

The `Predef` object provides definitions that are accessible in all Scala compilation units without explicit qualification.

##### Commonly Used Types

Predef provides type aliases for types which are commonly used, such as the immutable collection types scala.collection.immutable.Map and scala.collection.immutable.Set.

##### Console Output

For basic console output, `Predef` provides convenience methods print and println, which are aliases of the methods in the object scala.Console.

##### Assertions

A set of `assert` functions are provided for use as a way to document and dynamically check invariants in code. Invocations of `assert` can be elided at compile time by providing the command line option `-Xdisable-assertions`, which raises `-Xelide-below` above `elidable.ASSERTION`, to the `scalac` command.

Variants of `assert` intended for use with static analysis tools are also provided: `assume`, `require` and `ensuring`. `require` and `ensuring` are intended for use as a means of design-by-contract style specification of pre- and post-conditions on functions, with the intention that these specifications could be consumed by a static analysis tool. For instance,

    def addNaturals(nats: List[Int]): Int = {
      require(nats forall (_ >= 0), "List contains negative numbers")
      nats.foldLeft(0)(_ + _)
    } ensuring(_ >= 0)

The declaration of `addNaturals` states that the list of integers passed should only contain natural numbers (i.e. non-negative), and that the result returned will also be natural. `require` is distinct from `assert` in that if the condition fails, then the caller of the function is to blame rather than a logical error having been made within `addNaturals` itself. `ensuring` is a form of `assert` that declares the guarantee the function is providing with regards to its return value.

##### Implicit Conversions

A number of commonly applied implicit conversions are also defined here, and in the parent type scala.LowPriorityImplicits. Implicit conversions are provided for the "widening" of numeric values, for instance, converting a Short value to a Long value as required, and to add additional higher-order functions to Array values. These are described in more detail in the documentation of scala.Array.

Source
  Predef.scala

Linear Supertypes
LowPriorityImplicits, LowPriorityImplicits2, AnyRef, Any

Ordering

1. Grouped
2. Alphabetic
3. By Inheritance

Inherited

1. Predef
2. LowPriorityImplicits
3. LowPriorityImplicits2
4. AnyRef
5. Any

1. Hide All
2. Show All

Visibility

1. Public
2. Protected

### Type Members

1.  final class ArrayCharSequence extends CharSequence

2.  implicit final class ArrowAssoc[A] extends AnyVal

3.  type Class[T] = java.lang.Class[T]

4.  implicit final class Ensuring[A] extends AnyVal

5.  type Function[-A, +B] = (A) => B

6.  type Manifest[T] = reflect.Manifest[T]
   Annotations
     @implicitNotFound(msg = "No Manifest available for ${T}.")
7.  type Map[K, +V] = collection.immutable.Map[K, V]

8.  type OptManifest[T] = reflect.OptManifest[T]
9.  final class SeqCharSequence extends CharSequence

10.  type Set[A] = collection.immutable.Set[A]

11.  type String = java.lang.String

    The `String` type in Scala has all the methods of the underlying `java.lang.String`, of which it is just an alias.

    The `String` type in Scala has all the methods of the underlying `java.lang.String`, of which it is just an alias. (See the documentation corresponding to your Java version, for example https://docs.oracle.com/javase/8/docs/api/java/lang/String.html.) In addition, extension methods in scala.collection.StringOps are added implicitly through the conversion augmentString.

12.  implicit final class StringFormat[A] extends AnyVal

### Deprecated Type Members

1.  implicit final class any2stringadd[A] extends AnyVal

   Injects String concatenation operator `+` to any classes.

   Injects String concatenation operator `+` to any classes.

   Annotations
     @deprecated
   Deprecated

     (Since version 2.13.0) Implicit injection of + is deprecated. Convert to String to call +

### 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.  implicit def $conforms[A]: (A) => A

   An implicit of type `A => A` is available for all `A` because it can always be implemented using the identity function.

   An implicit of type `A => A` is available for all `A` because it can always be implemented using the identity function. This also means that an implicit of type `A => B` is always available when `A <: B`, because `(A => A) <: (A => B)`.

4.  val ->: Tuple2.type

   Allows destructuring tuples with the same syntax as constructing them.

   Allows destructuring tuples with the same syntax as constructing them.

   Example:

   1.     val tup = "foobar" -> 3

          val c = tup match {
            case str -> i => str.charAt(i)
          }

5.  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
6.  def ???: Nothing

   `???` can be used for marking methods that remain to be implemented.

   `???` can be used for marking methods that remain to be implemented.

   Exceptions thrown

     `NotImplementedError` when `???` is invoked.

7.  def ArrayCharSequence(arrayOfChars: Array[Char]): ArrayCharSequence

8.  implicit def Boolean2boolean(x: java.lang.Boolean): Boolean

9.  implicit def Byte2byte(x: java.lang.Byte): Byte

10.  implicit def Character2char(x: Character): Char

11.  implicit def Double2double(x: java.lang.Double): Double

12.  implicit def Float2float(x: java.lang.Float): Float

13.  implicit def Integer2int(x: Integer): Int

14.  implicit def Long2long(x: java.lang.Long): Long

15.  val Manifest: reflect.Manifest.type
16.  val Map: collection.immutable.Map.type

17.  val NoManifest: reflect.NoManifest.type
18.  def SeqCharSequence(sequenceOfChars: collection.IndexedSeq[Char]): SeqCharSequence

19.  val Set: collection.immutable.Set.type

20.  implicit def Short2short(x: java.lang.Short): Short

21.  final def asInstanceOf[T0]: T0

    Cast the receiver object to be of type `T0`.

    Cast the receiver object to be of type `T0`.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression `1.asInstanceOf[String]` will throw a `ClassCastException` at runtime, while the expression `List(1).asInstanceOf[List[String]]` will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested type.

    returns

      the receiver object.

    Definition Classes
      Any
    Exceptions thrown

      `ClassCastException` if the receiver object is not an instance of the erasure of type `T0`.

22.  final def assert(assertion: Boolean, message: => Any): Unit

    Tests an expression, throwing an `AssertionError` if false.

    Tests an expression, throwing an `AssertionError` if false. Calls to this method will not be generated if `-Xelide-below` is greater than `ASSERTION`.

    assertion

      the expression to test

    message

      a String to include in the failure message

    Annotations
      @elidable(level = ASSERTION) @inline()
    See also

      elidable

23.  def assert(assertion: Boolean): Unit

    Tests an expression, throwing an `AssertionError` if false.

    Tests an expression, throwing an `AssertionError` if false. Calls to this method will not be generated if `-Xelide-below` is greater than `ASSERTION`.

    assertion

      the expression to test

    Annotations
      @elidable(level = ASSERTION)
    See also

      elidable

24.  final def assume(assumption: Boolean, message: => Any): Unit

    Tests an expression, throwing an `AssertionError` if false.

    Tests an expression, throwing an `AssertionError` if false. This method differs from assert only in the intent expressed: assert contains a predicate which needs to be proven, while assume contains an axiom for a static checker. Calls to this method will not be generated if `-Xelide-below` is greater than `ASSERTION`.

    assumption

      the expression to test

    message

      a String to include in the failure message

    Annotations
      @elidable(level = ASSERTION) @inline()
    See also

      elidable

25.  def assume(assumption: Boolean): Unit

    Tests an expression, throwing an `AssertionError` if false.

    Tests an expression, throwing an `AssertionError` if false. This method differs from assert only in the intent expressed: assert contains a predicate which needs to be proven, while assume contains an axiom for a static checker. Calls to this method will not be generated if `-Xelide-below` is greater than `ASSERTION`.

    assumption

      the expression to test

    Annotations
      @elidable(level = ASSERTION)
    See also

      elidable

26.  implicit def augmentString(x: String): StringOps

    Annotations
      @inline()
27.  implicit def boolean2Boolean(x: Boolean): java.lang.Boolean

28.  implicit def booleanArrayOps(xs: Array[Boolean]): ArrayOps[Boolean]
    Annotations
      @inline()
29.  implicit def booleanWrapper(x: Boolean): RichBoolean
    Definition Classes
      LowPriorityImplicits
    Annotations
      @inline()
30.  implicit def byte2Byte(x: Byte): java.lang.Byte

31.  implicit def byteArrayOps(xs: Array[Byte]): ArrayOps[Byte]
    Annotations
      @inline()
32.  implicit def byteWrapper(x: Byte): RichByte

    We prefer the java.lang.* boxed types to these wrappers in any potential conflicts.

    We prefer the java.lang.* boxed types to these wrappers in any potential conflicts. Conflicts do exist because the wrappers need to implement ScalaNumber in order to have a symmetric equals method, but that implies implementing java.lang.Number as well.

    Note - these are inlined because they are value classes, but the call to xxxWrapper is not eliminated even though it does nothing. Even inlined, every call site does a no-op retrieval of Predef's MODULE$ because maybe loading Predef has side effects!

    Definition Classes
      LowPriorityImplicits
    Annotations
      @inline()
33.  implicit def char2Character(x: Char): Character

34.  implicit def charArrayOps(xs: Array[Char]): ArrayOps[Char]
    Annotations
      @inline()
35.  implicit def charWrapper(c: Char): RichChar
    Definition Classes
      LowPriorityImplicits
    Annotations
      @inline()
36.  def classOf[T]: Class[T]

    Retrieve the runtime representation of a class type.

    Retrieve the runtime representation of a class type. `classOf[T]` is equivalent to the class literal `T.class` in Java.

    returns

      The runtime Class representation of type `T`.

    Example:

    1.     val listClass = classOf[List[_]]
           // listClass is java.lang.Class[List[_]] = class scala.collection.immutable.List

           val mapIntString = classOf[Map[Int,String]]
           // mapIntString is java.lang.Class[Map[Int,String]] = interface scala.collection.immutable.Map

37.  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

38.  implicit def double2Double(x: Double): java.lang.Double

39.  implicit def doubleArrayOps(xs: Array[Double]): ArrayOps[Double]
    Annotations
      @inline()
40.  implicit def doubleWrapper(x: Double): RichDouble
    Definition Classes
      LowPriorityImplicits
    Annotations
      @inline()
41.  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
42.  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
43.  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

44.  implicit def float2Float(x: Float): java.lang.Float

45.  implicit def floatArrayOps(xs: Array[Float]): ArrayOps[Float]
    Annotations
      @inline()
46.  implicit def floatWrapper(x: Float): RichFloat
    Definition Classes
      LowPriorityImplicits
    Annotations
      @inline()
47.  implicit def genericArrayOps[T](xs: Array[T]): ArrayOps[T]
    Annotations
      @inline()
48.  implicit def genericWrapArray[T](xs: Array[T]): ArraySeq[T]

    Definition Classes
      LowPriorityImplicits
49.  final def getClass(): java.lang.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()
50.  def hashCode(): Int

    The hashCode method for reference types.

    The hashCode method for reference types. See hashCode in scala.Any.

    returns

      the hash code value for this object.

    Definition Classes
      AnyRef → Any
    Annotations
      @native()
51.  def identity[A](x: A): A

    A method that returns its input value.

    A method that returns its input value.

    A

      type of the input value x.

    x

      the value of type `A` to be returned.

    returns

      the value `x`.

    Annotations
      @inline()
52.  def implicitly[T](implicit e: T): T

    Summon an implicit value of type `T`.

    Summon an implicit value of type `T`. Usually, the argument is not passed explicitly.

    T

      the type of the value to be summoned

    returns

      the implicit value of type `T`

    Annotations
      @inline()
53.  implicit def int2Integer(x: Int): Integer

54.  implicit def intArrayOps(xs: Array[Int]): ArrayOps[Int]
    Annotations
      @inline()
55.  implicit def intWrapper(x: Int): RichInt
    Definition Classes
      LowPriorityImplicits
    Annotations
      @inline()
56.  final def isInstanceOf[T0]: Boolean

    Test whether the dynamic type of the receiver object is `T0`.

    Test whether the dynamic type of the receiver object is `T0`.

    Note that the result of the test is modulo Scala's erasure semantics. Therefore the expression `1.isInstanceOf[String]` will return `false`, while the expression `List(1).isInstanceOf[List[String]]` will return `true`. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the specified type.

    returns

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

    Definition Classes
      Any
57.  def locally[T](x: T): T

    Used to mark code blocks as being expressions, instead of being taken as part of anonymous classes and the like.

    Used to mark code blocks as being expressions, instead of being taken as part of anonymous classes and the like. This is just a different name for identity.

    Annotations
      @inline()
    Example:

    1. Separating code blocks from `new`:

           val x = new AnyRef
           {
             val y = ...
             println(y)
           }
           // the { ... } block is seen as the body of an anonymous class

           val x = new AnyRef

           {
             val y = ...
             println(y)
           }
           // an empty line is a brittle "fix"

           val x = new AnyRef
           locally {
             val y = ...
             println(y)
           }
           // locally guards the block and helps communicate intent

58.  implicit def long2Long(x: Long): java.lang.Long

59.  implicit def longArrayOps(xs: Array[Long]): ArrayOps[Long]
    Annotations
      @inline()
60.  implicit def longWrapper(x: Long): RichLong
    Definition Classes
      LowPriorityImplicits
    Annotations
      @inline()
61.  def manifest[T](implicit m: Manifest[T]): Manifest[T]
62.  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
63.  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

64.  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

65.  def optManifest[T](implicit m: OptManifest[T]): OptManifest[T]
66.  def print(x: Any): Unit

    Prints an object to `out` using its `toString` method.

    Prints an object to `out` using its `toString` method.

    x

      the object to print; may be null.

67.  def printf(text: String, xs: Any*): Unit

    Prints its arguments as a formatted string to the default output, based on a string pattern (in a fashion similar to printf in C).

    Prints its arguments as a formatted string to the default output, based on a string pattern (in a fashion similar to printf in C).

    The interpretation of the formatting patterns is described in java.util.Formatter.

    Consider using the f interpolator as more type safe and idiomatic.

    text

      the pattern for formatting the arguments.

    xs

      the arguments used to instantiate the pattern.

    Exceptions thrown

      `java.lang.IllegalArgumentException` if there was a problem with the format string or arguments

    See also

      StringContext.f

68.  def println(x: Any): Unit

    Prints out an object to the default output, followed by a newline character.

    Prints out an object to the default output, followed by a newline character.

    x

      the object to print.

69.  def println(): Unit

    Prints a newline character on the default output.

70.  implicit def refArrayOps[T <: AnyRef](xs: Array[T]): ArrayOps[T]
    Annotations
      @inline()
71.  final def require(requirement: Boolean, message: => Any): Unit

    Tests an expression, throwing an `IllegalArgumentException` if false.

    Tests an expression, throwing an `IllegalArgumentException` if false. This method is similar to `assert`, but blames the caller of the method for violating the condition.

    requirement

      the expression to test

    message

      a String to include in the failure message

    Annotations
      @inline()
72.  def require(requirement: Boolean): Unit

    Tests an expression, throwing an `IllegalArgumentException` if false.

    Tests an expression, throwing an `IllegalArgumentException` if false. This method is similar to `assert`, but blames the caller of the method for violating the condition.

    requirement

      the expression to test

73.  implicit def short2Short(x: Short): java.lang.Short

74.  implicit def shortArrayOps(xs: Array[Short]): ArrayOps[Short]
    Annotations
      @inline()
75.  implicit def shortWrapper(x: Short): RichShort
    Definition Classes
      LowPriorityImplicits
    Annotations
      @inline()
76.  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
77.  def toString(): java.lang.String

    Creates a String representation of this object.

    Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.

    returns

      a String representation of the object.

    Definition Classes
      AnyRef → Any
78.  implicit def tuple2ToZippedOps[T1, T2](x: (T1, T2)): Ops[T1, T2]
79.  implicit def tuple3ToZippedOps[T1, T2, T3](x: (T1, T2, T3)): Ops[T1, T2, T3]
80.  implicit def unitArrayOps(xs: Array[Unit]): ArrayOps[Unit]
    Annotations
      @inline()
81.  def valueOf[T](implicit vt: ValueOf[T]): T

    Retrieve the single value of a type with a unique inhabitant.

    Retrieve the single value of a type with a unique inhabitant.

    Annotations
      @inline()
    Example:

    1.     object Foo
           val foo = valueOf[Foo.type]
           // foo is Foo.type = Foo

           val bar = valueOf[23]
           // bar is 23.type = 23

82.  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

83.  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

84.  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

85.  implicit def wrapBooleanArray(xs: Array[Boolean]): ofBoolean

    Definition Classes
      LowPriorityImplicits
86.  implicit def wrapByteArray(xs: Array[Byte]): ofByte

    Definition Classes
      LowPriorityImplicits
87.  implicit def wrapCharArray(xs: Array[Char]): ofChar

    Definition Classes
      LowPriorityImplicits
88.  implicit def wrapDoubleArray(xs: Array[Double]): ofDouble

    Definition Classes
      LowPriorityImplicits
89.  implicit def wrapFloatArray(xs: Array[Float]): ofFloat

    Definition Classes
      LowPriorityImplicits
90.  implicit def wrapIntArray(xs: Array[Int]): ofInt

    Definition Classes
      LowPriorityImplicits
91.  implicit def wrapLongArray(xs: Array[Long]): ofLong

    Definition Classes
      LowPriorityImplicits
92.  implicit def wrapRefArray[T <: AnyRef](xs: Array[T]): ofRef[T]

    Definition Classes
      LowPriorityImplicits
93.  implicit def wrapShortArray(xs: Array[Short]): ofShort

    Definition Classes
      LowPriorityImplicits
94.  implicit def wrapString(s: String): WrappedString

    Definition Classes
      LowPriorityImplicits
95.  implicit def wrapUnitArray(xs: Array[Unit]): ofUnit

    Definition Classes
      LowPriorityImplicits

### Deprecated Value Members

1.  implicit def copyArrayToImmutableIndexedSeq[T](xs: Array[T]): IndexedSeq[T]
   Definition Classes
     LowPriorityImplicits2
   Annotations
     @deprecated
   Deprecated

     (Since version 2.13.0) Implicit conversions from Array to immutable.IndexedSeq are implemented by copying; Use the more efficient non-copying ArraySeq.unsafeWrapArray or an explicit toIndexedSeq call

### Inherited from LowPriorityImplicits

### Inherited from LowPriorityImplicits2

### Inherited from AnyRef

### Inherited from Any

### Utility Methods

### Assertions

These methods support program verification and runtime correctness.

### Console Output

These methods provide output via the console.

### Aliases

These aliases bring selected immutable types into scope without any imports.

### String Conversions

Conversions from String to StringOps or WrappedString.

### Implicit Classes

These implicit classes add useful extension methods to every type.

### CharSequence Wrappers

Wrappers that implements CharSequence and were implicit classes.

### Java to Scala

Implicit conversion from Java primitive wrapper types to Scala equivalents.

### Scala to Java

Implicit conversion from Scala AnyVals to Java primitive wrapper types equivalents.

### Array to ArraySeq

Conversions from Arrays to ArraySeqs.

### Ungrouped