Explicit instantiation of the Iterable trait to reduce class file size in subclasses.
Explicit instantiation of the Iterator trait to reduce class file size in subclasses.
Explicit instantiation of the Map trait to reduce class file size in subclasses.
Explicit instantiation of the Seq trait to reduce class file size in subclasses.
Explicit instantiation of the Set trait to reduce class file size in subclasses.
Explicit instantiation of the Traversable trait to reduce class file size in subclasses.
A common base class for mutable and immutable bitsets.
A common base class for mutable and immutable bitsets.
Bitsets are sets of non-negative integers which are represented as variable-size arrays of bits packed into 64-bit words. The memory footprint of a bitset is determined by the largest number stored in it.
A template trait for bitsets.
A template trait for bitsets.
Bitsets are sets of non-negative integers which are represented as variable-size arrays of bits packed into 64-bit words. The memory footprint of a bitset is determined by the largest number stored in it.
This trait provides most of the operations of a BitSet independently of its representation.
It is inherited by all concrete implementations of bitsets.
the type of the bitset itself.
Buffered iterators are iterators which provide a method head
that inspects the next element without discarding it.
Buffered iterators are iterators which provide a method head
that inspects the next element without discarding it.
2.8
2.8
A default map which implements the + and - methods of maps.
A default map which implements the + and - methods of maps.
Instances that inherit from DefaultMap[A, B] still have to define:
def get(key: A): Option[B] def iterator: Iterator[(A, B)]
It refers back to the original map.
It might also be advisable to override foreach or size if efficient
implementations can be found.
2.8
A trait for all iterable collections which may possibly have their operations implemented in parallel.
A trait for all iterable collections which may possibly have their operations implemented in parallel.
2.9
A template trait for all iterable collections which may possibly have their operations implemented in parallel.
A template trait for all iterable collections which may possibly have their operations implemented in parallel.
This trait contains abstract methods and methods that can be implemented directly in terms of other methods.
A trait for all traversable 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.
2.9
A trait for all maps upon which operations may be implemented in parallel.
A trait for all sequences which may possibly have their operations implemented in parallel.
A trait for all sequences which may possibly have their operations implemented in parallel.
2.9
A template trait for all sequences which may be traversed in parallel.
A trait for sets which may possibly have their operations implemented in parallel.
A trait for sets which may possibly have their operations implemented in parallel.
2.9
A template 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 trait for all traversable collections which may possibly have their operations implemented in parallel.
2.9
A template trait for all traversable collections upon which operations may be implemented in parallel.
A template trait for all traversable-once objects which may be traversed in parallel.
A template trait for all traversable-once objects which may be traversed in parallel.
Methods in this trait are either abstract or can be implemented in terms of other methods.
A base trait for indexed sequences.
A base trait for indexed sequences.
Indexed sequences support constant-time or near constant-time element
access and length computation. They are defined in terms of abstract methods
apply for indexing and length.
Indexed sequences do not add any new methods to Seq, but promise
efficient implementations of random access patterns.
A template trait for indexed sequences of type IndexedSeq[A].
A template trait for indexed sequences of type IndexedSeq[A].
Indexed sequences support constant-time or near constant-time element
access and length computation. They are defined in terms of abstract methods
apply for indexing and length.
Indexed sequences do not add any new methods to Seq, but promise
efficient implementations of random access patterns.
This trait just implements iterator in terms of apply and length.
However, see IndexedSeqOptimized for an implementation trait that overrides operations
to make them run faster under the assumption of fast random access with apply.
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 template trait for indexed sequences of type IndexedSeq[A] which optimizes
the implementation of several methods under the assumption of fast random access.
Indexed sequences support constant-time or near constant-time element
access and length computation. They are defined in terms of abstract methods
apply for indexing and length.
Indexed sequences do not add any new methods to Seq, but promise
efficient implementations of random access patterns.
A base trait for iterable collections.
A base trait for iterable collections.
This is a base trait for all Scala collections that define an iterator
method to step through one-by-one the collection's elements.
Implementations of this trait need to provide a concrete method with
signature:
def iterator: Iterator[A] They also need to provide a method newBuilder
which creates a builder for collections of the same kind.
This trait implements Iterable's foreach
method by stepping through all elements using iterator.
Subclasses should re-implement foreach with something more efficient,
if possible.
This trait adds methods iterator, sameElements,
takeRight, dropRight to the methods inherited
from trait
`Traversable`.
Note: This trait replaces every method that uses break in
TraversableLike by an iterator version.
A template trait for iterable collections of type Iterable[A].
A template trait for iterable collections of type Iterable[A].
This is a base trait for all Scala collections that define an iterator
method to step through one-by-one the collection's elements.
Implementations of this trait need to provide a concrete method with
signature:
def iterator: Iterator[A] They also need to provide a method newBuilder
which creates a builder for collections of the same kind.
This trait implements Iterable's foreach
method by stepping through all elements using iterator.
Subclasses should re-implement foreach with something more efficient,
if possible.
This trait adds methods iterator, sameElements,
takeRight, dropRight to the methods inherited
from trait
`Traversable`.
Note: This trait replaces every method that uses break in
TraversableLike by an iterator version.
This trait implements a proxy for iterable objects.
This trait implements a proxy for iterable objects. It forwards all calls to a different iterable object.
2.8
2.8
A base trait for non-strict views of Iterables.
A base trait for non-strict views of Iterables.
A view is a lazy version of some collection. Collection transformers such as
map or filter or ++ do not traverse any elements when applied on a view.
Instead they create a new view which simply records that fact that the operation
needs to be applied. The collection elements are accessed, and the view operations are applied,
when a non-view result is needed, or when the force method is called on a view.
All views for iterable collections are defined by re-interpreting the iterator method.
A template trait for non-strict views of iterable collections.
A template trait for non-strict views of iterable collections.
A view is a lazy version of some collection. Collection transformers such as
map or filter or ++ do not traverse any elements when applied on a view.
Instead they create a new view which simply records that fact that the operation
needs to be applied. The collection elements are accessed, and the view operations are applied,
when a non-view result is needed, or when the force method is called on a view.
All views for iterable collections are defined by re-interpreting the iterator method.
Iterators are data structures that allow to iterate over a sequence of elements.
Iterators are data structures that allow to iterate over a sequence
of elements. They have a hasNext method for checking
if there is a next element available, and a next method
which returns the next element and discards it from the iterator.
An iterator is mutable: most operations on it change its state. While it is often used to iterate through the elements of a collection, it can also be used without being backed by any collection (see constructors on the companion object).
It is of particular importance to note that, unless stated otherwise, one should never
use an iterator after calling a method on it. The two most important exceptions
are also the sole abstract methods: next and hasNext.
Both these methods can be called any number of times without having to discard the
iterator. Note that even hasNext may cause mutation -- such as when iterating
from an input stream, where it will block until the stream is closed or some
input becomes available.
Consider this example for safe and unsafe use:
def f[A](it: Iterator[A]) = { if (it.hasNext) { // Safe to reuse "it" after "hasNext" it.next // Safe to reuse "it" after "next" val remainder = it.drop(2) // it is *not* safe to use "it" again after this line! remainder.take(2) // it is *not* safe to use "remainder" after this line! } else it }
2.8
1
A base trait for linear sequences.
A base trait for linear sequences.
Linear sequences are defined in terms of three abstract methods, which are assumed to have efficient implementations. These are:
def isEmpty: Boolean def head: A def tail: Repr
Here, A is the type of the sequence elements and Repr is the type of the sequence itself.
Linear sequences do not add any new methods to Seq, but promise efficient implementations
of linear access patterns.
A template trait for linear sequences of type LinearSeq[A].
A template trait for linear sequences of type LinearSeq[A].
Linear sequences are defined in terms of three abstract methods, which are assumed to have efficient implementations. These are:
def isEmpty: Boolean def head: A def tail: Repr
Here, A is the type of the sequence elements and Repr is the type of the sequence itself.
Linear sequences do not add any new methods to Seq, but promise efficient implementations
of linear access patterns.
This trait just implements iterator in terms of isEmpty, head, and tail.
However, see LinearSeqOptimized for an implementation trait that overrides operations
to make them run faster under the assumption of fast linear access with head and tail.
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 template trait for linear sequences of type LinearSeq[A] which optimizes
the implementation of several methods under the assumption of fast linear access.
Linear sequences are defined in terms of three abstract methods, which are assumed to have efficient implementations. These are:
def isEmpty: Boolean def head: A def tail: Repr
Here, A is the type of the sequence elements and Repr is the type of the sequence itself.
Linear sequences do not add any new methods to Seq, but promise efficient implementations
of linear access patterns.
A map from keys of type A to values of type B.
A map from keys of type A to values of type B.
Implementation note:
This trait provides most of the operations of a Map independently of its representation.
It is typically inherited by concrete implementations of maps.
To implement a concrete map, you need to provide implementations of the following methods:
def get(key: A): Option[B] def iterator: Iterator[(A, B)] def + [B1 >: B](kv: (A, B1)): This def -(key: A): This
If you wish that methods like take, drop, filter also return the same kind of map
you should also override:
def empty: This It is also good idea to override methods foreach and
size for efficiency.
Note: If you do not have specific implementations for add and - in mind,
you might consider inheriting from DefaultMap instead.
Note: If your additions and mutations return the same kind of map as the map
you are defining, you should inherit from MapLike as well.
the type of the keys in this map.
the type of the values associated with keys.
1.0
A template trait for maps, which associate keys with values.
A template trait for maps, which associate keys with values.
Implementation note:
This trait provides most of the operations of a Map independently of its representation.
It is typically inherited by concrete implementations of maps.
To implement a concrete map, you need to provide implementations of the following methods:
def get(key: A): Option[B] def iterator: Iterator[(A, B)] def + [B1 >: B](kv: (A, B1)): This def -(key: A): This
If you wish that methods like take, drop, filter also return the same kind of map
you should also override:
def empty: This It is also good idea to override methods foreach and
size for efficiency.
2.8
This is a simple wrapper class for scala.collection.Map.
This is a simple wrapper class for scala.collection.Map. It is most useful for assembling customized map abstractions dynamically using object composition and forwarding.
1.0, 21/07/2003
1
A marker trait for collections which have their operations parallelised.
A marker trait for collections which have their operations parallelised.
2.9
This trait describes collections which can be turned into parallel collections
by invoking the method par.
This trait describes collections which can be turned into parallel collections
by invoking the method par. Parallelizable collections may be parametrized with
a target type different than their own.
the type of the elements in the collection
the actual type of the collection, which has to be parallel
A base trait for sequences.
A base trait for sequences.
Sequences are special cases of iterable collections of class Iterable.
Unlike iterables, sequences always have a defined order of elements.
Sequences provide a method apply for indexing. Indices range from 0 up to the length of
a sequence. Sequences support a number of methods to find occurrences of elements or subsequences, including
segmentLength, prefixLength, indexWhere, indexOf, lastIndexWhere, lastIndexOf,
startsWith, endsWith, indexOfSlice.
Another way to see a sequence is as a PartialFunction from Int values
to the element type of the sequence. The isDefinedAt method of a sequence
returns true for the interval from 0 until length.
Sequences can be accessed in reverse order of their elements, using methods
reverse and reverseIterator.
Sequences have two principal subtraits, IndexedSeq and LinearSeq, which give different guarantees for performance.
An IndexedSeq provides fast random-access of elements and a fast length operation.
A LinearSeq provides fast access only to the first element via head, but also
has a fast tail operation.
A template trait for sequences of type Seq[A]
A template trait for sequences of type Seq[A]
Sequences are special cases of iterable collections of class Iterable.
Unlike iterables, sequences always have a defined order of elements.
Sequences provide a method apply for indexing. Indices range from 0 up to the length of
a sequence. Sequences support a number of methods to find occurrences of elements or subsequences, including
segmentLength, prefixLength, indexWhere, indexOf, lastIndexWhere, lastIndexOf,
startsWith, endsWith, indexOfSlice.
Another way to see a sequence is as a PartialFunction from Int values
to the element type of the sequence. The isDefinedAt method of a sequence
returns true for the interval from 0 until length.
Sequences can be accessed in reverse order of their elements, using methods
reverse and reverseIterator.
Sequences have two principal subtraits, IndexedSeq and LinearSeq, which give different guarantees for performance.
An IndexedSeq provides fast random-access of elements and a fast length operation.
A LinearSeq provides fast access only to the first element via head, but also
has a fast tail operation.
A base trait for non-strict views of sequences.
A base trait for non-strict views of sequences.
A view is a lazy version of some collection. Collection transformers such as
map or filter or ++ do not traverse any elements when applied on a view.
Instead they create a new view which simply records that fact that the operation
needs to be applied. The collection elements are accessed, and the view operations are applied,
when a non-view result is needed, or when the force method is called on a view.
All views for sequences are defined by re-interpreting the length and
apply methods.
A template trait for non-strict views of sequences.
A template trait for non-strict views of sequences.
A view is a lazy version of some collection. Collection transformers such as
map or filter or ++ do not traverse any elements when applied on a view.
Instead they create a new view which simply records that fact that the operation
needs to be applied. The collection elements are accessed, and the view operations are applied,
when a non-view result is needed, or when the force method is called on a view.
All views for sequences are defined by re-interpreting the length and
apply methods.
A base trait for all sets, mutable as well as immutable.
A base trait for all sets, mutable as well as immutable.
A set is a collection that contains no duplicate elements.
To implement a concrete set, you need to provide implementations of the following methods:
def contains(key: A): Boolean def iterator: Iterator[A] def +(elem: A): This def -(elem: A): This
If you wish that methods like take, drop,
filter return the same kind of set, you should also override:
def empty: This It is also good idea to override methods foreach and
size for efficiency.
Implementation note: If your additions and mutations return the same kind of set as the set
you are defining, you should inherit from SetLike as well.
1.0
A template trait for sets.
A template trait for sets.
A set is a collection that contains no duplicate elements.
To implement a concrete set, you need to provide implementations of the following methods:
def contains(key: A): Boolean def iterator: Iterator[A] def +(elem: A): This def -(elem: A): This
If you wish that methods like take, drop,
filter return the same kind of set, you should also override:
def empty: This It is also good idea to override methods foreach and
size for efficiency.
Implementation note:
This trait provides most of the operations of a Set independently of its representation.
It is typically inherited by concrete implementations of sets.
2.8
This is a simple wrapper class for scala.collection.Set.
This is a simple wrapper class for scala.collection.Set. It is most useful for assembling customized set abstractions dynamically using object composition and forwarding.
2.0, 01/01/2007
A map whose keys are sorted.
A map whose keys are sorted.
2.8
2.4
A template for maps whose keys are sorted.
A template for maps whose keys are sorted.
To create a concrete sorted map, you need to implement the rangeImpl method,
in addition to those of MapLike.
2.8
2.8
A sorted set.
A sorted set.
2.8
2.4
A template for sets which are sorted.
A template for sets which are sorted.
2.8
2.8
A trait for traversable collections.
A trait for traversable collections. All operations are guaranteed to be performed in a single-threaded manner.
This is a base trait of all kinds of Scala collections. It
implements the behavior common to all collections, in terms of a method
foreach with signature:
def foreach[U](f: Elem => U): Unit
Collection classes mixing in this trait provide a concrete
foreach method which traverses all the
elements contained in the collection, applying a given function to each.
They also need to provide a method newBuilder
which creates a builder for collections of the same kind.
A traversable class might or might not have two properties: strictness and orderedness. Neither is represented as a type.
The instances of a strict collection class have all their elements
computed before they can be used as values. By contrast, instances of
a non-strict collection class may defer computation of some of their
elements until after the instance is available as a value.
A typical example of a non-strict collection class is a
scala.collection.immutable.Stream.
A more general class of examples are TraversableViews.
If a collection is an instance of an ordered collection class, traversing
its elements with foreach will always visit elements in the
same order, even for different runs of the program. If the class is not
ordered, foreach can visit elements in different orders for
different runs (but it will keep the same order in the same run).'
A typical example of a collection class which is not ordered is a
HashMap of objects. The traversal order for hash maps will
depend on the hash codes of its elements, and these hash codes might
differ from one run to the next. By contrast, a LinkedHashMap
is ordered because it's foreach method visits elements in the
order they were inserted into the HashMap.
A template trait for traversable collections of type Traversable[A].
A template trait for traversable collections of type Traversable[A].
This is a base trait of all kinds of Scala collections. It
implements the behavior common to all collections, in terms of a method
foreach with signature:
def foreach[U](f: Elem => U): Unit
Collection classes mixing in this trait provide a concrete
foreach method which traverses all the
elements contained in the collection, applying a given function to each.
They also need to provide a method newBuilder
which creates a builder for collections of the same kind.
A traversable class might or might not have two properties: strictness and orderedness. Neither is represented as a type.
The instances of a strict collection class have all their elements
computed before they can be used as values. By contrast, instances of
a non-strict collection class may defer computation of some of their
elements until after the instance is available as a value.
A typical example of a non-strict collection class is a
scala.collection.immutable.Stream.
A more general class of examples are TraversableViews.
If a collection is an instance of an ordered collection class, traversing
its elements with foreach will always visit elements in the
same order, even for different runs of the program. If the class is not
ordered, foreach can visit elements in different orders for
different runs (but it will keep the same order in the same run).'
A typical example of a collection class which is not ordered is a
HashMap of objects. The traversal order for hash maps will
depend on the hash codes of its elements, and these hash codes might
differ from one run to the next. By contrast, a LinkedHashMap
is ordered because it's foreach method visits elements in the
order they were inserted into the HashMap.
A template trait for collections which can be traversed either once only or one or more times.
A template trait for collections which can be traversed either once only or one or more times.
This trait exists primarily to eliminate code duplication between
Iterator and Traversable, and thus implements some of the common
methods that can be implemented solely in terms of foreach without
access to a Builder. It also includes a number of abstract methods
whose implementations are provided by Iterator, Traversable, etc.
It contains implementations common to Iterators and
Traversables, such as folds, conversions, and other operations which
traverse some or all of the elements and return a derived value.
Directly subclassing TraversableOnce is not recommended - instead,
consider declaring an Iterator with a next and hasNext method,
creating an Iterator with one of the methods on the Iterator object,
or declaring a subclass of Traversable.
2.8
2.8
This trait implements a proxy for traversable objects.
This trait implements a proxy for traversable objects. It forwards all calls to a different traversable object
2.8
2.8
A base trait for non-strict views of traversable collections.
A base trait for non-strict views of traversable collections.
A view is a lazy version of some collection. Collection transformers such as
map or filter or ++ do not traverse any elements when applied on a view.
Instead they create a new view which simply records that fact that the operation
needs to be applied. The collection elements are accessed, and the view operations are applied,
when a non-view result is needed, or when the force method is called on a view.
All views for traversable collections are defined by creating a new foreach method.
A template trait for non-strict views of traversable collections.
A template trait for non-strict views of traversable collections.
A view is a lazy version of some collection. Collection transformers such as
map or filter or ++ do not traverse any elements when applied on a view.
Instead they create a new view which simply records that fact that the operation
needs to be applied. The collection elements are accessed, and the view operations are applied,
when a non-view result is needed, or when the force method is called on a view.
All views for traversable collections are defined by creating a new foreach method.
Implementation note: Methods such as map or flatMap on this view will not invoke the implicitly passed
Builder factory, but will return a new view directly, to preserve by-name behavior.
The new view is then cast to the factory's result type. This means that every CanBuildFrom
that takes a View as its From type parameter must yield the same view (or a generic
superclass of it) as its result parameter. If that assumption is broken, cast errors might result.
This trait implements a proxy for Iterable objects.
This trait implements a proxy for Iterable objects. It forwards all calls to a different Iterable object.
(Since version 2.11.0) Proxying is deprecated due to lack of use and compiler-level support.
2.8
2.8
This trait implements a proxy for Map objects.
This trait implements a proxy for Map objects. It forwards all calls to a different Map object.
(Since version 2.11.0) Proxying is deprecated due to lack of use and compiler-level support.
2.8
2.8
This trait implements a proxy for sequence objects.
This trait implements a proxy for sequence objects. It forwards all calls to a different sequence object.
(Since version 2.11.0) Proxying is deprecated due to lack of use and compiler-level support.
2.8
2.8
This trait implements a proxy for sequences.
This trait implements a proxy for sequences. It forwards all calls to a different sequence.
(Since version 2.11.0) Proxying is deprecated due to lack of use and compiler-level support.
2.8
2.8
This trait implements a proxy for sets.
This trait implements a proxy for sets. It forwards all calls to a different set.
(Since version 2.11.0) Proxying is deprecated due to lack of use and compiler-level support.
2.8
This trait implements a proxy for Traversable objects.
This trait implements a proxy for Traversable objects. It forwards all calls to a different Traversable object.
(Since version 2.11.0) Proxying is deprecated due to lack of use and compiler-level support.
2.8
2.8
An extractor used to head/tail deconstruct sequences.
An extractor used to init/last deconstruct sequences.
This object provides a set of operations to create values.BitSet
Companion object for BitSets.
Companion object for BitSets. Contains private data only
This object provides a set of operations to create values.IndexedSeq
This object provides a set of operations to create values.
The current default implementation of a IndexedSeqIndexedSeq is a Vector.
This object provides a set of operations to create values.Iterable
This object provides a set of operations to create values.
The current default implementation of a IterableIterable is a List.
An object containing the necessary implicit definitions to make
IterableViews work.
An object containing the necessary implicit definitions to make
IterableViews work. Its definitions are generally not accessed directly by clients.
The Iterator object provides various functions for creating specialized iterators.
The Iterator object provides various functions for creating specialized iterators.
2.8
2.8
A collection of implicit conversions supporting interoperability between Scala and Java collections.
A collection of implicit conversions supporting interoperability between Scala and Java collections.
The following conversions are supported:
scala.collection.Iterable <=> java.lang.Iterable scala.collection.Iterable <=> java.util.Collection scala.collection.Iterator <=> java.util.{ Iterator, Enumeration } scala.collection.mutable.Buffer <=> java.util.List scala.collection.mutable.Set <=> java.util.Set scala.collection.mutable.Map <=> java.util.{ Map, Dictionary } scala.collection.concurrent.Map <=> java.util.concurrent.ConcurrentMap
In all cases, converting from a source type to a target type and back again will return the original source object, eg.
import scala.collection.JavaConversions._ val sl = new scala.collection.mutable.ListBuffer[Int] val jl : java.util.List[Int] = sl val sl2 : scala.collection.mutable.Buffer[Int] = jl assert(sl eq sl2)
In addition, the following one way conversions are provided:
scala.collection.Seq => java.util.List scala.collection.mutable.Seq => java.util.List scala.collection.Set => java.util.Set scala.collection.Map => java.util.Map java.util.Properties => scala.collection.mutable.Map[String, String]
2.8
A collection of decorators that allow converting between
Scala and Java collections using asScala and asJava methods.
A collection of decorators that allow converting between
Scala and Java collections using asScala and asJava methods.
The following conversions are supported via asJava, asScala
scala.collection.Iterable <=> java.lang.Iterablescala.collection.Iterator <=> java.util.Iteratorscala.collection.mutable.Buffer <=> java.util.Listscala.collection.mutable.Set <=> java.util.Setscala.collection.mutable.Map <=> java.util.Mapscala.collection.mutable.concurrent.Map <=> java.util.concurrent.ConcurrentMapIn all cases, converting from a source type to a target type and back again will return the original source object, e.g.
import scala.collection.JavaConverters._ val sl = new scala.collection.mutable.ListBuffer[Int] val jl : java.util.List[Int] = sl.asJava val sl2 : scala.collection.mutable.Buffer[Int] = jl.asScala assert(sl eq sl2)
The following conversions also are supported, but the
direction Scala to Java is done my a more specifically named method:
asJavaCollection, asJavaEnumeration, asJavaDictionary.
scala.collection.Iterable <=> java.util.Collectionscala.collection.Iterator <=> java.util.Enumerationscala.collection.mutable.Map <=> java.util.Dictionary In addition, the following one way conversions are provided via asJava:
scala.collection.Seq => java.util.Listscala.collection.mutable.Seq => java.util.Listscala.collection.Set => java.util.Setscala.collection.Map => java.util.Map
2.8.1
This object provides a set of operations to create values.LinearSeq
This object provides a set of operations to create values.
The current default implementation of a LinearSeqLinearSeq is a List.
This object provides a set of operations needed to create values.Map
A collection of wrappers that provide sequence classes with search functionality.
A collection of wrappers that provide sequence classes with search functionality.
Example usage:
import scala.collection.Searching._ val l = List(1, 2, 3, 4, 5) l.search(3) // == Found(2)
This object provides a set of operations to create values.Seq
This object provides a set of operations to create values.
The current default implementation of a SeqSeq is a List.
The companion object for trait SeqLike.
An object containing the necessary implicit definitions to make
SeqViews work.
An object containing the necessary implicit definitions to make
SeqViews work. Its definitions are generally not accessed directly by clients.
This object provides a set of operations needed to create values.Set
This object provides a set of operations needed to create values.
The current default implementation of a SetSet is one of EmptySet, Set1, Set2, Set3, Set4 in
class immutable.Set for sets of sizes up to 4, and a immutable.HashSet for sets of larger sizes.
2.8
2.8
This object provides a set of operations to create Traversable values.
This object provides a set of operations to create Traversable values.
The current default implementation of a Traversable is a List.
An object containing the necessary implicit definitions to make
TraversableViews work.
An object containing the necessary implicit definitions to make
TraversableViews work. Its definitions are generally not accessed directly by clients.
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://docs.scala-lang.org/overviews/collections/introduction.html.
Using Collections
It is convienient 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:
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 scala.collection.Seq, scala.collection.immutable.Set, and scala.collection.immutable.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 scala.collection.immutable collections over those in scala.collection.mutable; The types aliased in the
scala.Predefobject 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
JavaConversionsobject provides implicit defs that will allow mostly seamless integration between Java Collections-based APIs and the Scala collections library.