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:

    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 (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 parallel

    Package object for parallel collections.

    Package object for parallel collections.

    Definition Classes
    collection
  • trait ForkJoinTasks extends Tasks with HavingForkJoinPool

    An implementation trait for parallel tasks based on the fork/join framework.

    An implementation trait for parallel tasks based on the fork/join framework.

    Definition Classes
    parallel
  • WrappedTask

trait WrappedTask[R, +Tp] extends RecursiveAction with ForkJoinTasks.WrappedTask[R, Tp]

Source
Tasks.scala
Linear Supertypes
ForkJoinTasks.WrappedTask[R, Tp], RecursiveAction, ForkJoinTask[Void], java.io.Serializable, Future[Void], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WrappedTask
  2. WrappedTask
  3. RecursiveAction
  4. ForkJoinTask
  5. Serializable
  6. Future
  7. AnyRef
  8. Any
Implicitly
  1. by CollectionsHaveToParArray
  2. by any2stringadd
  3. by StringFormat
  4. by Ensuring
  5. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract val body: Task[R, Tp]

    the body of this task - what it executes, how it gets split and how results are merged.

    the body of this task - what it executes, how it gets split and how results are merged.

    Definition Classes
    WrappedTask
  2. abstract def compute(): Unit

    Code that gets called after the task gets started - it may spawn other tasks instead of calling leaf.

    Code that gets called after the task gets started - it may spawn other tasks instead of calling leaf.

    Definition Classes
    WrappedTask
  3. abstract def split: scala.Seq[ForkJoinTasks.WrappedTask[R, Tp]]
    Definition Classes
    WrappedTask

Concrete Value Members

  1. def cancel(arg0: Boolean): Boolean
    Definition Classes
    ForkJoinTask → Future
  2. final def compareAndSetForkJoinTaskTag(arg0: Short, arg1: Short): Boolean
    Definition Classes
    ForkJoinTask
  3. def complete(arg0: Void): Unit
    Definition Classes
    ForkJoinTask
  4. def completeExceptionally(arg0: java.lang.Throwable): Unit
    Definition Classes
    ForkJoinTask
  5. final def fork(): ForkJoinTask[Void]
    Definition Classes
    ForkJoinTask
  6. final def get(arg0: Long, arg1: TimeUnit): Void
    Definition Classes
    ForkJoinTask → Future
    Annotations
    @throws( ... ) @throws( ... ) @throws( ... )
  7. final def get(): Void
    Definition Classes
    ForkJoinTask → Future
    Annotations
    @throws( ... ) @throws( ... )
  8. final def getException(): java.lang.Throwable
    Definition Classes
    ForkJoinTask
  9. final def getForkJoinTaskTag(): Short
    Definition Classes
    ForkJoinTask
  10. final def getRawResult(): Void
    Definition Classes
    RecursiveAction → ForkJoinTask
  11. final def invoke(): Void
    Definition Classes
    ForkJoinTask
  12. final def isCancelled(): Boolean
    Definition Classes
    ForkJoinTask → Future
  13. final def isCompletedAbnormally(): Boolean
    Definition Classes
    ForkJoinTask
  14. final def isCompletedNormally(): Boolean
    Definition Classes
    ForkJoinTask
  15. final def isDone(): Boolean
    Definition Classes
    ForkJoinTask → Future
  16. final def join(): Void
    Definition Classes
    ForkJoinTask
  17. final def quietlyComplete(): Unit
    Definition Classes
    ForkJoinTask
  18. final def quietlyInvoke(): Unit
    Definition Classes
    ForkJoinTask
  19. final def quietlyJoin(): Unit
    Definition Classes
    ForkJoinTask
  20. def reinitialize(): Unit
    Definition Classes
    ForkJoinTask
  21. def release(): Unit

    If the task has been cancelled successfully, those syncing on it may automatically be notified, depending on the implementation.

    If the task has been cancelled successfully, those syncing on it may automatically be notified, depending on the implementation. If they aren't, this release method should be called after processing the cancelled task.

    This method may be overridden.

    Definition Classes
    WrappedTask
  22. final def setForkJoinTaskTag(arg0: Short): Short
    Definition Classes
    ForkJoinTask
  23. def start(): Unit

    Start task.

    Start task.

    Definition Classes
    WrappedTaskWrappedTask
  24. def sync(): Unit

    Wait for task to finish.

    Wait for task to finish.

    Definition Classes
    WrappedTaskWrappedTask
  25. def toParArray: ParArray[T]
    Implicit
    This member is added by an implicit conversion from WrappedTask[R, Tp] to CollectionsHaveToParArray[WrappedTask[R, Tp], T] performed by method CollectionsHaveToParArray in scala.collection.parallel. This conversion will take place only if an implicit value of type (WrappedTask[R, Tp]) ⇒ GenTraversableOnce[T] is in scope.
    Definition Classes
    CollectionsHaveToParArray
  26. def tryCancel(): Boolean

    Try to cancel the task.

    Try to cancel the task.

    returns

    true if cancellation is successful.

    Definition Classes
    WrappedTaskWrappedTask
  27. def tryUnfork(): Boolean
    Definition Classes
    ForkJoinTask