A common base class for mutable and immutable bitsets.
A template trait for bitsets.
Buffered iterators are iterators which provide a method head
that inspects the next element without discarding it.
A default map which implements the +
and -
methods of maps.
A trait for all iterable collections which may possibly have their operations implemented in parallel.
A trait for all traversable collections which may possibly have their operations implemented in parallel.
A trait for all sequences which may possibly have their operations implemented in parallel.
A trait for sets which may possibly have their operations implemented in parallel.
A trait for all traversable collections which may possibly have their operations implemented in parallel.
A template trait for all traversable-once objects which may be traversed in parallel.
A base trait for indexed sequences.
A template trait for indexed sequences of type IndexedSeq[A]
.
A template trait for indexed sequences of type IndexedSeq[A]
which optimizes
the implementation of several methods under the assumption of fast random access.
A base trait for iterable collections.
A template trait for iterable collections of type Iterable[A]
.
This trait implements a proxy for iterable objects.
This trait implements a proxy for Iterable objects.
A base trait for non-strict views of Iterable
s.
A template trait for non-strict views of iterable collections.
Iterators are data structures that allow to iterate over a sequence of elements.
A base trait for linear sequences.
A template trait for linear sequences of type LinearSeq[A]
.
A template trait for linear sequences of type LinearSeq[A]
which optimizes
the implementation of several methods under the assumption of fast linear access.
A map from keys of type A
to values of type B
.
A template trait for maps, which associate keys with values.
This is a simple wrapper class for scala.collection.Map
.
This trait implements a proxy for Map objects.
A marker trait for collections which have their operations parallelised.
This trait describes collections which can be turned into parallel collections
by invoking the method par
.
A base trait for sequences.
A template trait for sequences of type Seq[A]
This trait implements a proxy for sequence objects.
This trait implements a proxy for sequences.
A base trait for non-strict views of sequences.
A template trait for non-strict views of sequences.
A base trait for all sets, mutable as well as immutable.
A template trait for sets.
This is a simple wrapper class for scala.collection.Set
.
This trait implements a proxy for sets.
A map whose keys are sorted.
A template for maps whose keys are sorted.
A sorted set.
A template for sets which are sorted.
A trait for traversable collections.
A template trait for traversable collections of type Traversable[A]
.
A template trait for collections which can be traversed either once only or one or more times.
This trait implements a proxy for traversable objects.
This trait implements a proxy for Traversable objects.
A base trait for non-strict views of traversable collections.
A template trait for non-strict views of traversable collections.
This object provides a set of operations to create BitSet
values.
Companion object for BitSets.
This object provides a set of operations to create IndexedSeq
values.
This object provides a set of operations to create Iterable
values.
An object containing the necessary implicit definitions to make
IterableView
s work.
The Iterator
object provides various functions for
creating specialized iterators.
A collection of implicit conversions supporting interoperability between Scala and Java collections.
A collection of decorators that allow to convert between
Scala and Java collections using asScala
and asJava
methods.
This object provides a set of operations to create LinearSeq
values.
This object provides a set of operations needed to create Map
values.
This object provides a set of operations to create Seq
values.
The companion object for trait SeqLike
.
An object containing the necessary implicit definitions to make
SeqView
s work.
This object provides a set of operations needed to create Set
values.
This object provides a set of operations to create Traversable
values.
An object containing the necessary implicit definitions to make
TraversableView
s work.
Provides a CanBuildFrom instance that builds a specific target collection (To')
irrespective of the original collection (
From').
Provides a CanBuildFrom instance that builds a specific target collection (To')
irrespective of the original collection (
From').
Package object for parallel collections.
Contains the base traits and objects needed to use and extend Scala's collection library.
Guide
A detailed guide for the collections library is available at http://www.scala-lang.org/docu/files/collections-api.
Using Collections
It is convienient to treat all collections as either a Traversable or 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:
Creating Collections
The most common way to create a collection is to use the companion objects as factories. Of these, the three most common are Seq, Set, and Map. Their companion objects are all available as type aliases the either the scala package or in
scala.Predef
, and can be used like so:It is also typical to use the immutable collections over those in mutable; The types aliased in the scala package and 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.
Converting between Java Collections
The
JavaConversions
object provides implicit defs that will allow mostly seamless integration between Java Collections-based APIs and the Scala collections library.