Explicit instantiation of the IndexedSeqView 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 MapView 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 SeqView 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 View trait to reduce class file size in subclasses.
A Stepper for arbitrary element types. See Stepper.
This class serves as a wrapper for Arrays with many of the operations found in indexed sequences. Where needed, instances of arrays are implicitly converted into this class. There is generally no reason to create an instance explicitly or use an ArrayOps type. It is better to work with plain Array types instead and rely on the implicit conversion to ArrayOps when calling a method (which does not actually allocate an instance of ArrayOps because it is a value class).
Neither Array nor ArrayOps are proper collection types (i.e. they do not extend Iterable or even IterableOnce). mutable.ArraySeq and immutable.ArraySeq serve this purpose.
The difference between this class and ArraySeqs is that calling transformer methods such as filter and map will yield an array, whereas an ArraySeq will remain an ArraySeq.
type of the elements contained in this array.
2.8
Base type of bitsets.
This trait provides most of the operations of a BitSet independently of its representation. It is inherited by all concrete implementations of bitsets.
Buffered iterators are iterators which provide a method head that inspects the next element without discarding it.
2.8
Builds a collection of type C from elements of type A when a source collection of type From is available. Implicit instances of BuildFrom are available for all collection types.
Type of source collection
Type of elements (e.g. Int, Boolean, etc.)
Type of collection (e.g. List[Int], TreeMap[Int, String], etc.)
Base trait for companion objects of collections that require an implicit ClassTag.
Collection type constructor (e.g. ArraySeq)
Collection type constructor (e.g. ArraySeq)
A Stepper for Doubles. See Stepper.
Base trait for companion objects of collections that require an implicit evidence.
Collection type constructor (e.g. ArraySeq)
Unary type constructor for the implicit evidence required for an element type (typically Ordering or ClassTag)
This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters. It is used for collections that have an additional constraint, expressed by the evidenceIterableFactory method.
The default implementations in this trait can be used in the common case when CC[A] is the same as C.
A factory that builds a collection of type C with elements of type A.
This is a general form of any factory (IterableFactory, SortedIterableFactory, MapFactory and SortedMapFactory) whose element type is fixed.
Type of elements (e.g. Int, Boolean, etc.)
Type of collection (e.g. List[Int], TreeMap[Int, String], etc.)
A Stepper for Ints. See Stepper.
Base trait for generic collections.
the element type of the collection
Base trait for companion objects of unconstrained collection types that may require multiple traversals of a source collection to build a target collection CC.
Collection type constructor (e.g. List)
This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters.
The default implementations in this trait can be used in the common case when CC[A] is the same as C.
A template trait for collections which can be traversed either once only or one or more times.
Note: IterableOnce does not extend IterableOnceOps. This is different than the general design of the collections library, which uses the following pattern:
trait Seq extends Iterable with SeqOps trait SeqOps extends IterableOps trait IndexedSeq extends Seq with IndexedSeqOps trait IndexedSeqOps extends SeqOps
The goal is to provide a minimal interface without any sequential operations. This allows third-party extension like Scala parallel collections to integrate at the level of IterableOnce without inheriting unwanted implementations.
This implementation trait can be mixed into an IterableOnce to get the basic methods that are shared between Iterator and Iterable. The IterableOnce must support multiple calls to iterator but may or may not return the same Iterator every time.
Base trait for Iterable operations
We require that for all child classes of Iterable the variance of the child class and the variance of the C parameter passed to IterableOps are the same. We cannot express this since we lack variance polymorphism. That's why we have to resort at some places to write C[A @uncheckedVariance].
type constructor of the collection (e.g. List, Set). Operations returning a collection with a different type of element B (e.g. map) return a CC[B].
type of the collection (e.g. List[Int], String, BitSet). Operations returning a collection with the same type of element (e.g. drop, filter) return a C.
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 advances 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
}
Base trait for linearly accessed sequences that have efficient head and tail operations. Known subclasses: List, LazyList
A Stepper for Longs. See Stepper.
This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters. It is used for maps.
Note that in maps, the CC type of the map is not the same as the CC type for the underlying iterable (which is fixed to Map in MapOps). This trait has therefore two type parameters CC and WithFilterCC. The withFilter method inherited from IterableOps is overridden with a compatible default implementation.
The default implementations in this trait can be used in the common case when CC[A] is the same as C.
Base Map implementation type
Type of keys
Type of values
type constructor of the map (e.g. HashMap). Operations returning a collection with a different type of entries (L, W) (e.g. map) return a CC[L, W].
type of the map (e.g. HashMap[Int, String]). Operations returning a collection with the same type of element (e.g. drop, filter) return a C.
Base trait for sequence collections
the element type of the collection
Collection type constructor (e.g. List)
A generic trait for ordered maps. Concrete classes have to provide functionality for the abstract methods in SeqMap.
Note that when checking for equality SeqMap does not take into account ordering.
the type of the keys contained in this linked map.
the type of the values associated with the keys in this linked map.
2.13
2.13
Base trait for Seq operations
the element type of the collection
type constructor of the collection (e.g. List, Set). Operations returning a collection with a different type of element B (e.g. map) return a CC[B].
type of the collection (e.g. List[Int], String, BitSet). Operations returning a collection with the same type of element (e.g. drop, filter) return a C.
Base trait for companion objects of collections that require an implicit Ordering.
Collection type constructor (e.g. SortedSet)
This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters. It is used for sorted maps.
Note that in sorted maps, the CC type of the map is not the same as the CC type for the underlying map (which is fixed to Map in SortedMapOps). This trait has therefore three type parameters CC, WithFilterCC and UnsortedCC. The withFilter method inherited from IterableOps is overridden with a compatible default implementation.
The default implementations in this trait can be used in the common case when CC[A] is the same as C.
This trait provides default implementations for the factory methods fromSpecific and newSpecificBuilder that need to be refined when implementing a collection type that refines the CC and C type parameters. It is used for sorted sets.
Note that in sorted sets, the CC type of the set is not the same as the CC type for the underlying iterable (which is fixed to Set in SortedSetOps). This trait has therefore two type parameters CC and WithFilterCC. The withFilter method inherited from IterableOps is overridden with a compatible default implementation.
The default implementations in this trait can be used in the common case when CC[A] is the same as C.
Type of elements (e.g. Int, Boolean, etc.)
Type of collection (e.g. List[Int], TreeMap[Int, String], etc.)
Steppers exist to enable creating Java streams over Scala collections, see scala.jdk.StreamConverters. Besides that use case, they allow iterating over collections holding unboxed primitives (e.g., Array[Int]) without boxing the elements.
Steppers have an iterator-like interface with methods hasStep and nextStep(). The difference to iterators - and the reason Stepper is not a subtype of Iterator - is that there are hand-specialized variants of Stepper for Int, Long and Double (IntStepper, etc.). These enable iterating over collections holding unboxed primitives (e.g., Arrays, scala.jdk.Accumulators) without boxing the elements.
The selection of primitive types (Int, Long and Double) matches the hand-specialized variants of Java Streams (java.util.stream.Stream, java.util.stream.IntStream, etc.) and the corresponding Java Spliterators (Spliterator, Spliterator.OfInt, etc.).
Steppers can be converted to Scala Iterators, Java Iterators and Java Spliterators. Primitive Steppers are converted to the corresponding primitive Java Iterators and Spliterators.
the element type of the Stepper
Trait that overrides iterable operations to take advantage of strict builders.
Elements type
Collection type constructor
Collection type
Trait that overrides map operations to take advantage of strict builders.
Type of keys
Type of values
Collection type constructor
Collection type
Trait that overrides set operations to take advantage of strict builders.
Elements type
Collection type constructor
Collection type
Trait that overrides sorted map operations to take advantage of strict builders.
Type of keys
Type of values
Collection type constructor
Collection type
Trait that overrides sorted set operations to take advantage of strict builders.
Elements type
Collection type constructor
Collection type
Views are collections whose transformation operations are non strict: the resulting elements are evaluated only when the view is effectively traversed (e.g. using foreach or foldLeft), or when the view is converted to a strict collection type (using the to operation).
A template trait that contains just the map, flatMap, foreach and withFilter methods of trait Iterable.
Element type (e.g. Int)
Collection type constructor (e.g. List)
This object provides a set of operations to create Map values.
This object provides a set of operations to create Seq values.
This object provides a set of operations to create Set values.
This object reifies operations on views as case classes
© 2002-2019 EPFL, with contributions from Lightbend.
Licensed under the Apache License, Version 2.0.
https://www.scala-lang.org/api/2.13.0/scala/collection/index.html