Scala Standard Library2.12.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.collection.parallel.immutable` - Immutable, parallel data-structures such as `ParVector`, `ParRange`, `ParHashMap` or `ParHashSet`
    - `scala.collection.parallel.mutable` - Mutable, parallel data-structures such as `ParArray`, `ParHashMap`, `ParTrieMap` or `ParHashSet`
  - `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.swing` - A convenient wrapper around Java's GUI framework called Swing (scala-swing.jar)
  - `scala.util.parsing` - Parser combinators, including an example implementation of a JSON parser (scala-parser-combinators.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 collection

  Contains the base traits and objects needed to use and extend Scala's collection library.

  Contains the base traits and objects needed to use and extend Scala's collection library.

  #### Guide

  A detailed guide for using the collections library is available at http://docs.scala-lang.org/overviews/collections/introduction.html. Developers looking to extend the collections library can find a description of its architecture at http://docs.scala-lang.org/overviews/core/architecture-of-scala-collections.html.

  #### Using Collections

  It is convenient to treat all collections as either a scala.collection.Traversable or scala.collection.Iterable, as these traits define the vast majority of operations on a collection.

  Collections can, of course, be treated as specifically as needed, and the library is designed to ensure that the methods that transform collections will return a collection of the same type:

      scala> val array = Array(1,2,3,4,5,6)
      array: Array[Int] = Array(1, 2, 3, 4, 5, 6)

      scala> array map { _.toString }
      res0: Array[String] = Array(1, 2, 3, 4, 5, 6)

      scala> val list = List(1,2,3,4,5,6)
      list: List[Int] = List(1, 2, 3, 4, 5, 6)

      scala> list map { _.toString }
      res1: List[String] = List(1, 2, 3, 4, 5, 6)

  #### Creating Collections

  The most common way to create a collection is to use its companion object as a factory. The three most commonly used collections are scala.collection.Seq, scala.collection.immutable.Set, and scala.collection.immutable.Map. They can be used directly as shown below since their companion objects are all available as type aliases in either the scala package or in `scala.Predef`. New collections are created like this:

      scala> val seq = Seq(1,2,3,4,1)
      seq: Seq[Int] = List(1, 2, 3, 4, 1)

      scala> val set = Set(1,2,3,4,1)
      set: scala.collection.immutable.Set[Int] = Set(1, 2, 3, 4)

      scala> val map = Map(1 -> "one", 2 -> "two", 3 -> "three", 2 -> "too")
      map: scala.collection.immutable.Map[Int,String] = Map(1 -> one, 2 -> too, 3 -> three)

  It is also typical to prefer the scala.collection.immutable collections over those in scala.collection.mutable; the types aliased in the `scala.Predef` object are the immutable versions.

  Also note that the collections library was carefully designed to include several implementations of each of the three basic collection types. These implementations have specific performance characteristics which are described in the guide.

  The concrete parallel collections also have specific performance characteristics which are described in the parallel collections guide

  ##### Converting to and from Java Collections

  The scala.collection.JavaConverters object provides a collection of decorators that allow converting between Scala and Java collections using `asScala` and `asJava` methods.

  Definition Classes
    scala
-  package concurrent
  Definition Classes
    collection
-  package convert
  Definition Classes
    collection
-  package generic
  Definition Classes
    collection
-  package immutable
  Definition Classes
    collection
-  package mutable
  Definition Classes
    collection
-  package parallel

  Package object for parallel collections.

  Package object for parallel collections.

  Definition Classes
    collection
-  package script
  Definition Classes
    collection
- End
- Include
- Index
- Location
- Message
- NoLo
- Remove
- Reset
- Script
- Scriptable
- Start
- Update

p

scala.collection

# script 

#### package script

Content Hierarchy
 
Ordering

1. Alphabetic

Visibility

1. Public
2. All

### Type Members

1.  case class Include [+A](location: Location, elem: A) extends Message[A] with Product with Serializable

   This observable update refers to inclusion operations that add new elements to collection classes.

   This observable update refers to inclusion operations that add new elements to collection classes.

   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

   Version

     1.0, 08/07/2003

2.  case class Index (n: Int) extends Location with Product with Serializable
   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

3.  sealed abstract class Location extends AnyRef

   Class `Location` describes locations in messages implemented by class scala.collection.script.Message.

   Class `Location` describes locations in messages implemented by class scala.collection.script.Message.

   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

   Version

     1.0, 10/05/2004

   Since

     2.8

4.  trait Message [+A] extends AnyRef

   Class `Message` represents messages that are issued by observable collection classes whenever a data structure is changed.

   Class `Message` represents messages that are issued by observable collection classes whenever a data structure is changed. Class `Message` has several subclasses for the various kinds of events: `Update` `Remove`, `Include`, `Reset`, and `Script`.

   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

   Version

     1.0, 08/07/2003

   Since

     2.8

5.  case class Remove [+A](location: Location, elem: A) extends Message[A] with Product with Serializable

   This observable update refers to removal operations of elements from collection classes.

   This observable update refers to removal operations of elements from collection classes.

   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

   Version

     1.0, 08/07/2003

6.  case class Reset [+A]() extends Message[A] with Product with Serializable

   This command refers to reset operations.

   This command refers to reset operations.

   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

   Version

     1.0, 08/07/2003

7.  class Script [A] extends ArrayBuffer[Message[A]] with Message[A]

   Objects of this class represent compound messages consisting of a sequence of other messages.

   Objects of this class represent compound messages consisting of a sequence of other messages.

   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

   Version

     1.0, 10/05/2004

8.  trait Scriptable [A] extends AnyRef

   Classes that mix in the `Scriptable` class allow messages to be sent to objects of that class.

   Classes that mix in the `Scriptable` class allow messages to be sent to objects of that class.

   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

   Version

     1.0, 09/05/2004

   Since

     2.8

9.  case class Update [+A](location: Location, elem: A) extends Message[A] with Product with Serializable

   This observable update refers to destructive modification operations of elements from collection classes.

   This observable update refers to destructive modification operations of elements from collection classes.

   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

   Version

     1.0, 08/07/2003

### Deprecated Value Members

1.  object End extends Location with Product with Serializable
   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

2.  object NoLo extends Location with Product with Serializable
   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

3.  object Start extends Location with Product with Serializable
   Annotations
     @deprecated
   Deprecated

     (Since version 2.11.0) scripting is deprecated

### Ungrouped