package collection
- Alphabetic
- By Inheritance
- collection
- LowPriority
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- abstract class AbstractIterable[+A] extends Iterable[A]
-
abstract
class
AbstractIterator[+A] extends Iterator[A]
Explicit instantiation of the
Iterator
trait to reduce class file size in subclasses. -
abstract
class
AbstractMap[A, +B] extends AbstractIterable[(A, B)] with Map[A, B]
Explicit instantiation of the
Map
trait to reduce class file size in subclasses. -
abstract
class
AbstractSeq[+A] extends AbstractIterable[A] with Seq[A]
Explicit instantiation of the
Seq
trait to reduce class file size in subclasses. -
type
AnyConstr[X] = Any
Needed to circumvent a difficulty between dotty and scalac concerning the right top type for a type parameter of kind * -> *.
Needed to circumvent a difficulty between dotty and scalac concerning the right top type for a type parameter of kind * -> *. In Scalac, we can provide
Any
, asAny
is kind-polymorphic. In dotty this is not allowed. In dotty, we can provide[X] => Any
. But Scalac does not know lambda syntax. -
trait
ArrayLike[+A] extends Any
A trait representing indexable collections with finite length
- final class ArrayOps[A] extends AnyVal with IterableOnce[A] with IndexedSeqOps[A, collection.immutable.IndexedSeq, Array[A]] with StrictOptimizedSeqOps[A, Seq, Array[A]] with ArrayLike[A]
-
trait
BitSet extends SortedSet[Int] with BitSetOps[BitSet]
Base type of bitsets.
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. -
trait
BitSetOps[+C <: BitSet with BitSetOps[C]] extends SortedSetOps[Int, SortedSet, C]
Base implementation type of bitsets
-
trait
BufferedIterator[+A] extends Iterator[A]
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.- Version
2.8
- Since
2.8
-
trait
BuildFrom[-From, -A, +C] extends Any
Builds a collection of type
C
from elements of typeA
when a source collection of typeFrom
is available.Builds a collection of type
C
from elements of typeA
when a source collection of typeFrom
is available. Implicit instances ofBuildFrom
are available for all collection types.- From
Type of source collection
- A
Type of elements (e.g.
Int
,Boolean
, etc.)- C
Type of collection (e.g.
List[Int]
,TreeMap[Int, String]
, etc.)
- Annotations
- @implicitNotFound( ... )
- trait BuildFromLowPriority extends AnyRef
-
trait
DefaultMap[K, +V] extends Map[K, V]
A default map which builds a default
immutable.Map
implementation for all transformations.A default map which builds a default
immutable.Map
implementation for all transformations.Instances that inherit from
DefaultMap[K, V]
still have to define:def get(key: K): Option[V] def iterator(): Iterator[(K, V)]
It might also be advisable to override
foreach
orsize
if efficient implementations can be found.- Since
2.8
-
trait
Factory[-A, +C] extends Any
A factory that builds a collection of type
C
with elements of typeA
.A factory that builds a collection of type
C
with elements of typeA
.This is a general form of any factory (IterableFactory, SortedIterableFactory, MapFactory and SortedMapFactory) whose element type is fixed.
- A
Type of elements (e.g.
Int
,Boolean
, etc.)- C
Type of collection (e.g.
List[Int]
,TreeMap[Int, String]
, etc.)
-
trait
IndexedSeq[+A] extends Seq[A] with IndexedSeqOps[A, IndexedSeq, IndexedSeq[A]]
Base trait for indexed sequences that have efficient
apply
andlength
-
trait
IndexedSeqOps[+A, +CC[X] <: IndexedSeq[X], +C] extends SeqOps[A, CC, C]
Base trait for indexed Seq operations
-
trait
IndexedView[+A] extends View[A] with ArrayLike[A] with SeqOps[A, View, View[A]]
View defined in terms of indexing a range
-
trait
Iterable[+A] extends IterableOnce[A] with IterableOps[A, Iterable, Iterable[A]] with Traversable[A]
Base trait for generic collections.
Base trait for generic collections.
- A
the element type of the collection
-
trait
IterableFactory[+CC[_]] extends IterableFactoryLike[CC]
Base trait for companion objects of unconstrained collection types that can build a target collection
CC
from a source collection with a single traversal of the source.Base trait for companion objects of unconstrained collection types that can build a target collection
CC
from a source collection with a single traversal of the source.- CC
Collection type constructor (e.g.
List
)
-
trait
IterableFactoryLike[+CC[_]] extends AnyRef
Base trait for companion objects of unconstrained collection types that may require multiple traversals of a source collection to build a target collection
CC
.Base trait for companion objects of unconstrained collection types that may require multiple traversals of a source collection to build a target collection
CC
.- CC
Collection type constructor (e.g.
List
)
-
trait
IterableOnce[+A] extends Any
A template trait for collections which can be traversed either once only or one or more times.
- final class IterableOnceExtensionMethods[A] extends AnyVal
-
trait
IterableOps[+A, +CC[_], +C] extends IterableOnce[A]
Base trait for Iterable operations
Base trait for Iterable operations
VarianceNote
We require that for all child classes of Iterable the variance of the child class and the variance of the
C
parameter passed toIterableOps
are the same. We cannot express this since we lack variance polymorphism. That's why we have to resort at some places to writeC[A @uncheckedVariance]
.- CC
type constructor of the collection (e.g.
List
,Set
). Operations returning a collection with a different type of elementB
(e.g.map
) return aCC[B]
.- C
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 aC
.
-
trait
Iterator[+A] extends IterableOnce[A]
A core Iterator class
-
final
class
LazyZip2[El1, El2, C1 <: Iterable[El1]] extends AnyRef
Decorator representing lazily zipped pairs.
-
final
class
LazyZip3[El1, El2, El3, C1 <: Iterable[El1]] extends AnyRef
Decorator representing lazily zipped triples.
-
final
class
LazyZip4[El1, El2, El3, El4, C1 <: Iterable[El1]] extends AnyRef
Decorator representing lazily zipped 4-tuples.
- final class LazyZipOps[A, C1 <: Iterable[A]] extends AnyVal
-
trait
LinearSeq[+A] extends Seq[A] with LinearSeqOps[A, LinearSeq, LinearSeq[A]]
Base trait for linearly accessed sequences that have efficient
head
andtail
operations.Base trait for linearly accessed sequences that have efficient
head
andtail
operations. Known subclasses: List, LazyList -
trait
LinearSeqOps[+A, +CC[X] <: LinearSeq[X], +C <: LinearSeq[A]] extends SeqOps[A, CC, C]
Base trait for linear Seq operations
-
trait
Map[K, +V] extends Iterable[(K, V)] with MapOps[K, V, Map, Map[K, V]] with Equals
Base Map type
- trait MapFactory[+CC[_, _]] extends AnyRef
-
trait
MapOps[K, +V, +CC[X, Y] <: MapOps[X, Y, CC, _], +C] extends IterableOps[(K, V), Iterable, C] with PartialFunction[K, V] with Equals
Base Map implementation type
Base Map implementation type
- K
Type of keys
- V
Type of values
- CC
type constructor of the map (e.g.
HashMap
). Operations returning a collection with a different type of entries(L, W)
(e.g.map
) return aCC[L, W]
.- C
type of the map (e.g.
HashMap[Int, String]
). Operations returning a collection with the same type of element (e.g.drop
,filter
) return aC
.
-
trait
Seq[+A] extends Iterable[A] with PartialFunction[Int, A] with SeqOps[A, Seq, Seq[A]] with Equals
Base trait for sequence collections
Base trait for sequence collections
- A
the element type of the collection
-
trait
SeqFactory[+CC[_]] extends IterableFactory[CC]
- CC
Collection type constructor (e.g.
List
)
-
trait
SeqOps[+A, +CC[_], +C] extends IterableOps[A, CC, C] with ArrayLike[A]
Base trait for Seq operations
Base trait for Seq operations
- A
the element type of the collection
- CC
type constructor of the collection (e.g.
List
,Set
). Operations returning a collection with a different type of elementB
(e.g.map
) return aCC[B]
.- C
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 aC
.
-
trait
Set[A] extends Iterable[A] with SetOps[A, Set, Set[A]] with Equals
Base trait for set collections.
-
trait
SetOps[A, +CC[_], +C <: SetOps[A, CC, C]] extends IterableOps[A, CC, C] with (A) ⇒ Boolean
Base trait for set operations
-
trait
SortedIterableFactory[+CC[_]] extends AnyRef
Base trait for companion objects of collections that require an implicit evidence
-
trait
SortedMap[K, +V] extends Map[K, V] with SortedMapOps[K, V, SortedMap, SortedMap[K, V]]
Base type of sorted sets
- trait SortedMapFactory[+CC[_, _]] extends AnyRef
- trait SortedMapOps[K, +V, +CC[X, Y] <: Map[X, Y] with SortedMapOps[X, Y, CC, _], +C <: SortedMapOps[K, V, CC, C]] extends MapOps[K, V, Map, C] with SortedOps[K, C]
-
trait
SortedOps[A, +C] extends AnyRef
Base trait for sorted collections
-
trait
SortedSet[A] extends Set[A] with SortedSetOps[A, SortedSet, SortedSet[A]]
Base type of sorted sets
- trait SortedSetOps[A, +CC[X] <: SortedSet[X], +C <: SortedSetOps[A, CC, C]] extends SetOps[A, Set, C] with SortedOps[A, C]
-
trait
SpecificIterableFactory[-A, +C] extends Factory[A, C]
- A
Type of elements (e.g.
Int
,Boolean
, etc.)- C
Type of collection (e.g.
List[Int]
,TreeMap[Int, String]
, etc.)
-
trait
StrictOptimizedIterableOps[+A, +CC[_], +C] extends IterableOps[A, CC, C]
Trait that overrides operations to take advantage of strict builders.
Trait that overrides operations to take advantage of strict builders.
- A
Elements type
- C
Collection type
- trait StrictOptimizedSeqFactory[+CC[_]] extends SeqFactory[CC]
-
trait
StrictOptimizedSeqOps[+A, +CC[_], +C] extends SeqOps[A, CC, C] with StrictOptimizedIterableOps[A, CC, C]
Trait that overrides operations on sequences in order to take advantage of strict builders.
- trait StrictOptimizedSortedSetOps[A, +CC[X] <: SortedSet[X], +C <: SortedSetOps[A, CC, C]] extends SortedSetOps[A, CC, C] with StrictOptimizedIterableOps[A, Set, C]
- final class StringOps extends AnyVal with IterableOnce[Char] with IndexedSeqOps[Char, collection.immutable.IndexedSeq, String] with StrictOptimizedIterableOps[Char, collection.immutable.IndexedSeq, String] with ArrayLike[Char] with Ordered[String]
- case class StringView(s: String) extends IndexedView[Char] with Product with Serializable
-
trait
View[+A] extends Iterable[A] with IterableOps[A, View, View[A]]
Views are collections whose transformation operations are non strict: the resulting elements are evaluated only when the view is effectively traversed (e.g.
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
orfoldLeft
), or when the view is converted to a strict collection type (using theto
operation). -
abstract
class
WithFilter[+A, +CC[_]] extends AnyRef
A template trait that contains just the
map
,flatMap
,foreach
andwithFilter
methods of traitIterable
.A template trait that contains just the
map
,flatMap
,foreach
andwithFilter
methods of traitIterable
.- A
Element type (e.g.
Int
)- CC
Collection type constructor (e.g.
List
)
- implicit final class toNewIterator[A] extends AnyVal
- implicit final class toNewSeq[A] extends AnyVal
- implicit final class toOldIterator[A] extends AnyVal
- implicit final class toOldSeq[A] extends AnyVal
-
type
GenIterable[+X] = Iterable[X]
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
type
GenMap[K, +V] = Map[K, V]
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
type
GenSeq[+X] = Seq[X]
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
type
GenSet[X] = Set[X]
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
type
GenTraversable[+X] = Iterable[X]
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
type
GenTraversableOnce[+X] = IterableOnce[X]
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
type
SeqLike[A, T] = SeqOps[A, Seq, T]
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use SeqOps instead of SeqLike
-
trait
Traversable[+A] extends Any
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use Iterable instead of Traversable
Value Members
-
implicit
def
arrayToArrayOps[A](as: Array[A]): ArrayOps[A]
Decorator to add collection operations to arrays.
-
implicit
def
arrayToWrappedArray[T](xs: Array[T]): collection.mutable.IndexedSeq[T]
Convert array to WrappedArray.
Convert array to WrappedArray. Lower priority than ArrayOps
- Definition Classes
- LowPriority
- implicit def optionToIterableOnce[A](maybeA: Option[A]): IterableOnce[A]
-
implicit
def
stringToSeq(s: String): WrappedString
Convert String to Seq.
Convert String to Seq. Lower priority than StringOps
- Definition Classes
- LowPriority
-
implicit
def
stringToStringOps(s: String): StringOps
Decorator to add collection operations to strings.
-
object
+:
An extractor used to head/tail deconstruct sequences.
-
object
:+
An extractor used to init/last deconstruct sequences.
- object ArrayOps
- object BitSet extends SpecificIterableFactory[Int, BitSet]
- object BitSetOps
- object BuildFrom extends BuildFromLowPriority
- object Factory
-
object
Hashing
- Attributes
- protected
- object IndexedSeq extends Delegate[IndexedSeq]
- object IndexedView
- object Iterable extends Delegate[Iterable]
- object IterableFactory
- object IterableOnce
- object Iterator
-
object
JavaConverters extends DecorateAsJava with DecorateAsScala
A variety of decorators that enable converting between Scala and Java collections using extension methods,
asScala
andasJava
.A variety of decorators that enable converting between Scala and Java collections using extension methods,
asScala
andasJava
.The extension methods return adapters for the corresponding API.
The following conversions are supported via
asScala
andasJava
:strawman.collection.Iterable <=> java.lang.Iterable strawman.collection.Iterator <=> java.util.Iterator strawman.collection.mutable.Buffer <=> java.util.List strawman.collection.mutable.Set <=> java.util.Set strawman.collection.mutable.Map <=> java.util.Map strawman.collection.concurrent.Map <=> java.util.concurrent.ConcurrentMap
The following conversions are supported via
asScala
and through specially-named extension methods to convert to Java collections, as shown:strawman.collection.Iterable <=> java.util.Collection (via asJavaCollection) strawman.collection.Iterator <=> java.util.Enumeration (via asJavaEnumeration) strawman.collection.mutable.Map <=> java.util.Dictionary (via asJavaDictionary)
In addition, the following one-way conversions are provided via
asJava
:strawman.collection.Seq => java.util.List strawman.collection.mutable.Seq => java.util.List strawman.collection.Set => java.util.Set strawman.collection.Map => java.util.Map
The following one way conversion is provided via
asScala
:java.util.Properties => strawman.collection.mutable.Map
In all cases, converting from a source type to a target type and back again will return the original source object. For example:
import strawman.collection.JavaConverters._ val source = new strawman.collection.mutable.ListBuffer[Int] val target: java.util.List[Int] = source.asJava val other: strawman.collection.mutable.Buffer[Int] = target.asScala assert(source eq other)
Alternatively, the conversion methods have descriptive names and can be invoked explicitly.
scala> val vs = java.util.Arrays.asList("hi", "bye") vs: java.util.List[String] = [hi, bye] scala> val ss = asScalaIterator(vs.iterator) ss: Iterator[String] = non-empty iterator scala> .toList res0: List[String] = List(hi, bye) scala> val ss = asScalaBuffer(vs) ss: strawman.collection.mutable.Buffer[String] = Buffer(hi, bye)
- Since
2.8.1
- object LazyZip2
- object LazyZip3
- object LazyZip4
-
object
Map extends Delegate[Map]
This object provides a set of operations to create
Map
values. - object MapFactory
-
object
Seq extends Delegate[Seq]
This object provides a set of operations to create
Seq
values. - object SeqFactory
- object SeqOps
-
object
Set extends Delegate[Set]
This object provides a set of operations to create
Set
values. - object SortedIterableFactory
- object SortedMap extends Delegate[SortedMap]
- object SortedMapFactory
- object SortedSet extends Delegate[SortedSet]
- object StringOps
-
object
View extends IterableFactoryLike[View]
This object reifies operations on views as case classes
Deprecated Value Members
-
val
GenIterable: Iterable.type
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
val
GenMap: Map.type
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
val
GenSeq: Seq.type
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
val
GenSet: Set.type
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
val
GenTraversable: Iterable.type
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
val
GenTraversableOnce: IterableOnce.type
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Gen* collection types have been removed
-
val
Traversable: Iterable.type
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use Iterable instead of Traversable