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, 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 generic
    Definition Classes
    collection
  • abstract class ParMapFactory [CC[X, Y] <: ParMap[X, Y] with ParMapLike[X, Y, CC[X, Y], _]] extends GenMapFactory[CC] with GenericParMapCompanion[CC]

    A template class for companion objects of ParMap and subclasses thereof.

    A template class for companion objects of ParMap and subclasses thereof. This class extends TraversableFactory and provides a set of operations to create ParMap objects.

    Definition Classes
    generic
  • CanCombineFromMap
  • MapCanBuildFrom

class CanCombineFromMap[K, V] extends CanCombineFrom[CC[_, _], (K, V), CC[K, V]]

Source
ParMapFactory.scala
Linear Supertypes
CanCombineFrom[CC[_, _], (K, V), CC[K, V]], Parallel, CanBuildFrom[CC[_, _], (K, V), CC[K, V]], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CanCombineFromMap
  2. CanCombineFrom
  3. Parallel
  4. CanBuildFrom
  5. AnyRef
  6. 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

Instance Constructors

  1. new CanCombineFromMap()

Value Members

  1. def apply(): Combiner[(K, V), CC[K, V]]

    Creates a new builder from scratch.

    Creates a new builder from scratch.

    returns

    a builder for collections of type To with element type Elem.

    Definition Classes
    CanCombineFromMapCanCombineFromCanBuildFrom
    See also

    scala.collection.breakOut

  2. def apply(from: MapColl): Combiner[(K, V), CC[K, V]]

    Creates a new builder on request of a collection.

    Creates a new builder on request of a collection.

    from

    the collection requesting the builder to be created.

    returns

    a builder for collections of type To with element type Elem. The collections framework usually arranges things so that the created builder will build the same kind of collection as from.

    Definition Classes
    CanCombineFromMapCanCombineFromCanBuildFrom
  3. def toParArray: ParArray[T]
    Implicit
    This member is added by an implicit conversion from CanCombineFromMap[K, V] to CollectionsHaveToParArray[CanCombineFromMap[K, V], T] performed by method CollectionsHaveToParArray in scala.collection.parallel. This conversion will take place only if an implicit value of type (CanCombineFromMap[K, V]) ⇒ GenTraversableOnce[T] is in scope.
    Definition Classes
    CollectionsHaveToParArray