ParSeq

scala.collection.parallel.mutable.ParSeq
See theParSeq companion object
trait ParSeq[T] extends ParIterable[T], ParSeq[T], GenericParTemplate[T, ParSeq], ParSeqLike[T, ParSeq, ParSeq[T], Seq[T]]

A mutable variant of ParSeq.

Attributes

Companion
object
Graph
Supertypes
trait ParSeq[T]
trait ParSeqLike[T, ParSeq, ParSeq[T], Seq[T]]
trait Equals
trait ParIterable[T]
trait ParIterable[T]
trait ParIterableLike[T, ParSeq, ParSeq[T], Seq[T]]
trait Parallel
trait Parallelizable[T, ParSeq[T]]
trait IterableOnce[T]
trait HasNewCombiner[T, ParSeq[T]]
trait HasNewBuilder[T, ParSeq[T]]
class Object
trait Matchable
class Any
Show all
Known subtypes
class ParArray[T]
Self type
ParSeq[T]

Members list

Type members

Inherited classlikes

protected trait Accessor[R, Tp] extends StrictSplitterCheckTask[R, Tp]

Standard accessor task that iterates over the elements of the collection.

Standard accessor task that iterates over the elements of the collection.

Type parameters

R

type of the result of this method (R for result).

Tp

the representation type of the task at hand.

Attributes

Inherited from:
ParIterableLike
Supertypes
trait Task[R, Tp]
class Object
trait Matchable
class Any
Known subtypes
trait Transformer[R, Tp]
class Copy[U, That]
trait ParSeqLikeTransformer[R, Tp]
trait ParSeqLikeAccessor[R, Tp]
trait BuilderOps[Elem, To]

Attributes

Inherited from:
ParIterableLike
Supertypes
class Object
trait Matchable
class Any
protected class Copy[U >: T, That](cfactory: CombinerFactory[U, That], val pit: IterableSplitter[T]) extends Transformer[Combiner[U, That], Copy[U, That]]

Attributes

Inherited from:
ParIterableLike
Supertypes
trait Transformer[Combiner[U, That], Copy[U, That]]
trait Accessor[Combiner[U, That], Copy[U, That]]
trait StrictSplitterCheckTask[Combiner[U, That], Copy[U, That]]
trait Task[Combiner[U, That], Copy[U, That]]
class Object
trait Matchable
class Any
Show all
protected trait ParSeqLikeAccessor[R, Tp] extends Accessor[R, Tp]

Attributes

Inherited from:
ParSeqLike
Supertypes
trait Accessor[R, Tp]
trait Task[R, Tp]
class Object
trait Matchable
class Any
Show all
Known subtypes
trait ParSeqLikeTransformer[R, Tp]
protected trait ParSeqLikeTransformer[R, Tp] extends ParSeqLikeAccessor[R, Tp], Transformer[R, Tp]

Attributes

Inherited from:
ParSeqLike
Supertypes
trait Transformer[R, Tp]
trait ParSeqLikeAccessor[R, Tp]
trait Accessor[R, Tp]
trait Task[R, Tp]
class Object
trait Matchable
class Any
Show all

Attributes

Inherited from:
ParIterableLike
Supertypes
class Object
trait Matchable
class Any
protected trait StrictSplitterCheckTask[R, Tp] extends Task[R, Tp]

Attributes

Inherited from:
ParIterableLike
Supertypes
trait Task[R, Tp]
class Object
trait Matchable
class Any
Known subtypes
trait Accessor[R, Tp]
trait Transformer[R, Tp]
class Copy[U, That]
trait ParSeqLikeTransformer[R, Tp]
trait ParSeqLikeAccessor[R, Tp]
trait TaskOps[R, Tp]

Attributes

Inherited from:
ParIterableLike
Supertypes
class Object
trait Matchable
class Any
protected trait Transformer[R, Tp] extends Accessor[R, Tp]

Attributes

Inherited from:
ParIterableLike
Supertypes
trait Accessor[R, Tp]
trait Task[R, Tp]
class Object
trait Matchable
class Any
Show all
Known subtypes
class Copy[U, That]
trait ParSeqLikeTransformer[R, Tp]

Inherited and Abstract classlikes

abstract protected class Elements(start: Int, val end: Int) extends SeqSplitter[T], BufferedIterator[T]

Used to iterate elements using indices

Used to iterate elements using indices

Attributes

Inherited from:
ParSeqLike
Supertypes
trait BufferedIterator[T]
trait SeqSplitter[T]
trait PreciseSplitter[T]
trait IterableSplitter[T]
trait Signalling
trait Splitter[T]
trait Iterator[T]
trait IterableOnce[T]
class Object
trait Matchable
class Any
Show all

Inherited types

type SSCTask[R, Tp] = StrictSplitterCheckTask[R, Tp]

Attributes

Inherited from:
ParIterableLike

Value members

Abstract methods

def seq: Seq[T]

A sequential collection containing the same elements as this collection

A sequential collection containing the same elements as this collection

Attributes

def update(i: Int, elem: T): Unit

Concrete methods

The factory companion object that builds instances of class mutable.ParSeq. (or its Iterable superclass where class mutable.ParSeq is not a Seq.)

The factory companion object that builds instances of class mutable.ParSeq. (or its Iterable superclass where class mutable.ParSeq is not a Seq.)

Attributes

Definition Classes
override def toSeq: ParSeq[T]

Attributes

Definition Classes

Inherited methods

def ++[U >: T](that: IterableOnce[U]): ParSeq[U]

Attributes

Inherited from:
ParIterableLike
def +:[U >: T, That](elem: U): ParSeq[U]

Attributes

Inherited from:
ParSeqLike
def /:[S](z: S)(op: (S, T) => S): S

Attributes

Inherited from:
ParIterableLike
def :+[U >: T, That](elem: U): ParSeq[U]

Attributes

Inherited from:
ParSeqLike
def :\[S](z: S)(op: (T, S) => S): S

Attributes

Inherited from:
ParIterableLike
def aggregate[S](z: => S)(seqop: (S, T) => S, combop: (S, S) => S): S

Aggregates the results of applying an operator to subsequent elements.

Aggregates the results of applying an operator to subsequent elements.

This is a more general form of fold and reduce. It has similar semantics, but does not require the result to be a supertype of the element type. It traverses the elements in different partitions sequentially, using seqop to update the result, and then applies combop to results from different partitions. The implementation of this operation may operate on an arbitrary number of collection partitions, so combop may be invoked arbitrary number of times.

For example, one might want to process some elements and then produce a Set. In this case, seqop would process an element and append it to the set, while combop would concatenate two sets from different partitions together. The initial value z would be an empty set.

  pc.aggregate(Set[Int]())(_ += process(_), _ ++ _)

Another example is calculating geometric mean from a collection of doubles (one would typically require big doubles for this).

Type parameters

S

the type of accumulated results

Value parameters

combop

an associative operator used to combine results from different partitions

seqop

an operator used to accumulate results within a partition

z

the initial value for the accumulated result of the partition - this will typically be the neutral element for the seqop operator (e.g. Nil for list concatenation or 0 for summation) and may be evaluated more than once

Attributes

Inherited from:
ParIterableLike
def canEqual(other: Any): Boolean

Attributes

Inherited from:
ParSeqLike
def collect[S](pf: PartialFunction[T, S]): ParSeq[S]

Attributes

Inherited from:
ParIterableLike
def copyToArray[U >: T](xs: Array[U], start: Int, len: Int): Unit

Attributes

Inherited from:
ParIterableLike
def copyToArray[U >: T](xs: Array[U], start: Int): Unit

Attributes

Inherited from:
ParIterableLike
def copyToArray[U >: T](xs: Array[U]): Unit

Attributes

Inherited from:
ParIterableLike
def corresponds[S](that: ParSeq[S])(p: (T, S) => Boolean): Boolean

Tests whether every element of this parallel iterable relates to the corresponding element of another parallel sequence by satisfying a test predicate.

Tests whether every element of this parallel iterable relates to the corresponding element of another parallel sequence by satisfying a test predicate.

This method will use abort signalling capabilities. This means that splitters may send and read abort signals.

Type parameters

S

the type of the elements of that

Value parameters

p

the test predicate, which relates elements from both sequences

that

the other parallel sequence

Attributes

Returns

true if both parallel sequences have the same length and p(x, y) is true for all corresponding elements x of this parallel iterable and y of that, otherwise false

Inherited from:
ParSeqLike
def count(p: T => Boolean): Int

Attributes

Inherited from:
ParIterableLike

Attributes

Inherited from:
ParIterableLike
def diff[U >: T](that: Seq[U]): ParSeq[T]

Attributes

Inherited from:
ParSeqLike
def diff[U >: T](that: ParSeq[U]): ParSeq[T]

Attributes

Inherited from:
ParSeqLike
def distinct: ParSeq[T]

Builds a new parallel iterable from this parallel iterable without any duplicate elements.

Builds a new parallel iterable from this parallel iterable without any duplicate elements.

Note: will not terminate for infinite-sized collections.

This trait defines a new, more general split operation and reimplements the split operation of ParallelIterable trait using the new split operation.

Attributes

Returns

A new parallel iterable which contains the first occurrence of every element of this parallel iterable.

Inherited from:
ParSeqLike
def drop(n: Int): ParSeq[T]

Attributes

Inherited from:
ParIterableLike
def dropWhile(pred: T => Boolean): ParSeq[T]

Drops all elements in the longest prefix of elements that satisfy the predicate, and returns a collection composed of the remaining elements.

Drops all elements in the longest prefix of elements that satisfy the predicate, and returns a collection composed of the remaining elements.

This method will use indexFlag signalling capabilities. This means that splitters may set and read the indexFlag state. The index flag is initially set to maximum integer value.

Value parameters

pred

the predicate used to test the elements

Attributes

Returns

a collection composed of all the elements after the longest prefix of elements in this parallel iterable that satisfy the predicate pred

Inherited from:
ParIterableLike
def endsWith[S >: T](that: Iterable[S]): Boolean

Tests whether this parallel iterable ends with the given collection.

Tests whether this parallel iterable ends with the given collection.

This method will use abort signalling capabilities. This means that splitters may send and read abort signals.

Type parameters

S

the type of the elements of that sequence

Value parameters

that

the sequence to test

Attributes

Returns

true if this parallel iterable has that as a suffix, false otherwise

Inherited from:
ParSeqLike
def endsWith[S >: T](that: ParSeq[S]): Boolean

Tests whether this parallel iterable ends with the given parallel sequence.

Tests whether this parallel iterable ends with the given parallel sequence.

This method will use abort signalling capabilities. This means that splitters may send and read abort signals.

Type parameters

S

the type of the elements of that sequence

Value parameters

that

the sequence to test

Attributes

Returns

true if this parallel iterable has that as a suffix, false otherwise

Inherited from:
ParSeqLike
override def equals(that: Any): Boolean

The equals method for arbitrary parallel sequences. Compares this parallel sequence to some other object.

The equals method for arbitrary parallel sequences. Compares this parallel sequence to some other object.

Value parameters

that

The object to compare the sequence to

Attributes

Returns

true if that is a sequence that has the same elements as this sequence in the same order, false otherwise

Definition Classes
ParSeqLike -> Equals -> Any
Inherited from:
ParSeqLike
def exists(p: T => Boolean): Boolean

Tests whether a predicate holds for some element of this parallel iterable.

Tests whether a predicate holds for some element of this parallel iterable.

This method will use abort signalling capabilities. This means that splitters may send and read abort signals.

Value parameters

p

a predicate used to test elements

Attributes

Returns

true if p holds for some element, false otherwise

Inherited from:
ParIterableLike
def filter(pred: T => Boolean): ParSeq[T]

Attributes

Inherited from:
ParIterableLike
def filterNot(pred: T => Boolean): ParSeq[T]

Attributes

Inherited from:
ParIterableLike
def find(p: T => Boolean): Option[T]

Finds some element in the collection for which the predicate holds, if such an element exists. The element may not necessarily be the first such element in the iteration order.

Finds some element in the collection for which the predicate holds, if such an element exists. The element may not necessarily be the first such element in the iteration order.

If there are multiple elements obeying the predicate, the choice is nondeterministic.

This method will use abort signalling capabilities. This means that splitters may send and read abort signals.

Value parameters

p

predicate used to test the elements

Attributes

Returns

an option value with the element if such an element exists, or None otherwise

Inherited from:
ParIterableLike
def flatMap[S](f: T => IterableOnce[S]): ParSeq[S]

Attributes

Inherited from:
ParIterableLike
def flatten[B](implicit asTraversable: T => IterableOnce[B]): ParSeq[B]

Converts this collection of traversable collections into a collection formed by the elements of these traversable collections.

Converts this collection of traversable collections into a collection formed by the elements of these traversable collections.

Type parameters

B

the type of the elements of each traversable collection.

Value parameters

asTraversable

an implicit conversion which asserts that the element type of this collection is a GenTraversable.

Attributes

Returns

a new collection resulting from concatenating all element collections.

Inherited from:
GenericTraversableTemplate
def fold[U >: T](z: U)(op: (U, U) => U): U

Folds the elements of this sequence using the specified associative binary operator. The order in which the elements are reduced is unspecified and may be nondeterministic.

Folds the elements of this sequence using the specified associative binary operator. The order in which the elements are reduced is unspecified and may be nondeterministic.

Note this method has a different signature than the foldLeft and foldRight methods of the trait Traversable. The result of folding may only be a supertype of this parallel collection's type parameter T.

Type parameters

U

a type parameter for the binary operator, a supertype of T.

Value parameters

op

a binary operator that must be associative

z

a neutral element for the fold operation, it may be added to the result an arbitrary number of times, not changing the result (e.g. Nil for list concatenation, 0 for addition, or 1 for multiplication)

Attributes

Returns

the result of applying fold operator op between all the elements and z

Inherited from:
ParIterableLike
def foldLeft[S](z: S)(op: (S, T) => S): S

Attributes

Inherited from:
ParIterableLike
def foldRight[S](z: S)(op: (T, S) => S): S

Attributes

Inherited from:
ParIterableLike
def forall(p: T => Boolean): Boolean

Tests whether a predicate holds for all elements of this parallel iterable.

Tests whether a predicate holds for all elements of this parallel iterable.

This method will use abort signalling capabilities. This means that splitters may send and read abort signals.

Value parameters

p

a predicate used to test elements

Attributes

Returns

true if p holds for all elements, false otherwise

Inherited from:
ParIterableLike
def foreach[U](f: T => U): Unit

Applies a function f to all the elements of parallel iterable in an undefined order.

Applies a function f to all the elements of parallel iterable in an undefined order.

Type parameters

U

the result type of the function applied to each element, which is always discarded

Value parameters

f

function applied to each element

Attributes

Inherited from:
ParIterableLike
override def genericBuilder[B]: Combiner[B, ParSeq[B]]

The generic builder that builds instances of $Coll at arbitrary element types.

The generic builder that builds instances of $Coll at arbitrary element types.

Attributes

Definition Classes
Inherited from:
GenericParTemplate

Attributes

Inherited from:
GenericParTemplate
def groupBy[K](f: T => K): ParMap[K, ParSeq[T]]

Attributes

Inherited from:
ParIterableLike

Attributes

Inherited from:
ParIterableLike
override def hashCode(): Int

Calculates a hash code value for the object.

Calculates a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
ParSeqLike -> Any
Inherited from:
ParSeqLike
def head: T

Attributes

Inherited from:
ParIterableLike
def headOption: Option[T]

Attributes

Inherited from:
ParIterableLike
def indexOf[B >: T](elem: B, from: Int): Int

Finds index of first occurrence of some value in this parallel iterable after or at some start index.

Finds index of first occurrence of some value in this parallel iterable after or at some start index.

Type parameters

B

the type of the element elem.

Value parameters

elem

the element value to search for.

from

the start index

Attributes

Returns

the index >= from of the first element of this parallel iterable that is equal (as determined by ==) to elem, or -1, if none exists.

Inherited from:
ParSeqLike
def indexOf[B >: T](elem: B): Int

Finds index of first occurrence of some value in this parallel iterable.

Finds index of first occurrence of some value in this parallel iterable.

Type parameters

B

the type of the element elem.

Value parameters

elem

the element value to search for.

Attributes

Returns

the index of the first element of this parallel iterable that is equal (as determined by ==) to elem, or -1, if none exists.

Inherited from:
ParSeqLike
def indexWhere(p: T => Boolean, from: Int): Int

Finds the first element satisfying some predicate.

Finds the first element satisfying some predicate.

This method will use indexFlag signalling capabilities. This means that splitters may set and read the indexFlag state.

The index flag is initially set to maximum integer value.

Value parameters

from

the starting offset for the search

p

the predicate used to test the elements

Attributes

Returns

the index >= from of the first element of this parallel iterable that satisfies the predicate p, or -1, if none exists

Inherited from:
ParSeqLike
def indexWhere(p: T => Boolean): Int

Finds index of first element satisfying some predicate.

Finds index of first element satisfying some predicate.

Note: may not terminate for infinite-sized collections.

Value parameters

p

the predicate used to test elements.

Attributes

Returns

the index of the first element of this parallel iterable that satisfies the predicate p, or -1, if none exists.

Inherited from:
ParSeqLike
def init: ParSeq[T]

Attributes

Inherited from:
ParIterableLike
protected def initTaskSupport(): Unit

Attributes

Inherited from:
ParIterableLike
def intersect[U >: T](that: Seq[U]): ParSeq[T]

Computes the multiset intersection between this parallel iterable and another sequence.

Computes the multiset intersection between this parallel iterable and another sequence.

Type parameters

U

the element type of that parallel sequence

Value parameters

that

the sequence of elements to intersect with.

Attributes

Returns

a new collection of type That which contains all elements of this parallel iterable which also appear in that. If an element value x appears ''n'' times in that, then the first ''n'' occurrences of x will be retained in the result, but any following occurrences will be omitted.

Inherited from:
ParSeqLike
def isDefinedAt(idx: Int): Boolean

Tests whether this parallel iterable contains given index.

Tests whether this parallel iterable contains given index.

The implementations of methods apply and isDefinedAt turn a ParSeq[T] into a PartialFunction[Int, T].

Value parameters

idx

the index to test

Attributes

Returns

true if this parallel iterable contains an element at position idx, false otherwise.

Inherited from:
ParSeqLike

Attributes

Inherited from:
ParIterableLike

Denotes whether this parallel collection has strict splitters.

Denotes whether this parallel collection has strict splitters.

This is true in general, and specific collection instances may choose to override this method. Such collections will fail to execute methods which rely on splitters being strict, i.e. returning a correct value in the remaining method.

This method helps ensure that such failures occur on method invocations, rather than later on and in unpredictable ways.

Attributes

Inherited from:
ParIterableLike

Attributes

Inherited from:
ParIterableLike
override def iterator: PreciseSplitter[T]

Creates a new split iterator used to traverse the elements of this collection.

Creates a new split iterator used to traverse the elements of this collection.

By default, this method is implemented in terms of the protected splitter method.

Attributes

Returns

a split iterator

Definition Classes
Inherited from:
ParSeqLike
def knownSize: Int

Attributes

Inherited from:
IterableOnce
def last: T

Attributes

Inherited from:
ParIterableLike
def lastIndexOf[B >: T](elem: B, end: Int): Int

Finds index of last occurrence of some value in this parallel iterable before or at a given end index.

Finds index of last occurrence of some value in this parallel iterable before or at a given end index.

Type parameters

B

the type of the element elem.

Value parameters

elem

the element value to search for.

end

the end index.

Attributes

Returns

the index <= end of the last element of this parallel iterable that is equal (as determined by ==) to elem, or -1, if none exists.

Inherited from:
ParSeqLike
def lastIndexOf[B >: T](elem: B): Int

Finds index of last occurrence of some value in this parallel iterable.

Finds index of last occurrence of some value in this parallel iterable.

Note: will not terminate for infinite-sized collections.

This trait defines a new, more general split operation and reimplements the split operation of ParallelIterable trait using the new split operation.

Type parameters

B

the type of the element elem.

Value parameters

elem

the element value to search for.

Attributes

Returns

the index of the last element of this parallel iterable that is equal (as determined by ==) to elem, or -1, if none exists.

Inherited from:
ParSeqLike
def lastIndexWhere(p: T => Boolean, end: Int): Int

Finds the last element satisfying some predicate.

Finds the last element satisfying some predicate.

This method will use indexFlag signalling capabilities. This means that splitters may set and read the indexFlag state.

The index flag is initially set to minimum integer value.

Value parameters

end

the maximum offset for the search

p

the predicate used to test the elements

Attributes

Returns

the index <= end of the first element of this parallel iterable that satisfies the predicate p, or -1, if none exists

Inherited from:
ParSeqLike
def lastIndexWhere(p: T => Boolean): Int

Finds index of last element satisfying some predicate.

Finds index of last element satisfying some predicate.

Note: will not terminate for infinite-sized collections.

This trait defines a new, more general split operation and reimplements the split operation of ParallelIterable trait using the new split operation.

Value parameters

p

the predicate used to test elements.

Attributes

Returns

the index of the last element of this parallel iterable that satisfies the predicate p, or -1, if none exists.

Inherited from:
ParSeqLike
def lastOption: Option[T]

Attributes

Inherited from:
ParIterableLike
def map[S](f: T => S): ParSeq[S]

Attributes

Inherited from:
ParIterableLike
def max[U >: T](implicit ord: Ordering[U]): T

Attributes

Inherited from:
ParIterableLike
def maxBy[S](f: T => S)(implicit cmp: Ordering[S]): T

Attributes

Inherited from:
ParIterableLike
def min[U >: T](implicit ord: Ordering[U]): T

Attributes

Inherited from:
ParIterableLike
def minBy[S](f: T => S)(implicit cmp: Ordering[S]): T

Attributes

Inherited from:
ParIterableLike

Attributes

Inherited from:
ParIterableLike
def mkString(sep: String): String

Attributes

Inherited from:
ParIterableLike
def mkString(start: String, sep: String, end: String): String

Attributes

Inherited from:
ParIterableLike

Attributes

Inherited from:
ParIterableLike
def padTo[U >: T](len: Int, elem: U): ParSeq[U]

Attributes

Inherited from:
ParSeqLike
override def par: ParSeq[T]

Returns a parallel implementation of this collection.

Returns a parallel implementation of this collection.

For most collection types, this method creates a new parallel collection by copying all the elements. For these collection, par takes linear time. Mutable collections in this category do not produce a mutable parallel collection that has the same underlying dataset, so changes in one collection will not be reflected in the other one.

Specific collections (e.g. ParArray or mutable.ParHashMap) override this default behaviour by creating a parallel collection which shares the same underlying dataset. For these collections, par takes constant or sublinear time.

All parallel collections return a reference to themselves.

Attributes

Returns

a parallel implementation of this collection

Definition Classes
Inherited from:
ParIterableLike
def partition(pred: T => Boolean): (ParSeq[T], ParSeq[T])

Attributes

Inherited from:
ParIterableLike
def patch[U >: T](from: Int, patch: ParSeq[U], replaced: Int): ParSeq[U]

Attributes

Inherited from:
ParSeqLike
def patch[U >: T](from: Int, patch: Seq[U], replaced: Int): ParSeq[U]

Overload of ''patch'' that takes a sequential collection as parameter

Overload of ''patch'' that takes a sequential collection as parameter

Attributes

Inherited from:
ParSeqLike
def prefixLength(p: T => Boolean): Int

Returns the length of the longest prefix whose elements all satisfy some predicate.

Returns the length of the longest prefix whose elements all satisfy some predicate.

Note: may not terminate for infinite-sized collections.

Value parameters

p

the predicate used to test elements.

Attributes

Returns

the length of the longest prefix of this parallel iterable such that every element of the segment satisfies the predicate p.

Inherited from:
ParSeqLike
def product[U >: T](implicit num: Numeric[U]): U

Attributes

Inherited from:
ParIterableLike
def reduce[U >: T](op: (U, U) => U): U

Reduces the elements of this sequence using the specified associative binary operator.

Reduces the elements of this sequence using the specified associative binary operator.

The order in which operations are performed on elements is unspecified and may be nondeterministic.

Note this method has a different signature than the reduceLeft and reduceRight methods of the trait Traversable. The result of reducing may only be a supertype of this parallel collection's type parameter T.

Type parameters

U

A type parameter for the binary operator, a supertype of T.

Value parameters

op

A binary operator that must be associative.

Attributes

Returns

The result of applying reduce operator op between all the elements if the collection is nonempty.

Throws
UnsupportedOperationException

if this parallel iterable is empty.

Inherited from:
ParIterableLike
def reduceLeft[U >: T](op: (U, T) => U): U

Attributes

Inherited from:
ParIterableLike
def reduceLeftOption[U >: T](op: (U, T) => U): Option[U]

Attributes

Inherited from:
ParIterableLike
def reduceOption[U >: T](op: (U, U) => U): Option[U]

Optionally reduces the elements of this sequence using the specified associative binary operator.

Optionally reduces the elements of this sequence using the specified associative binary operator.

The order in which operations are performed on elements is unspecified and may be nondeterministic.

Note this method has a different signature than the reduceLeftOption and reduceRightOption methods of the trait Traversable. The result of reducing may only be a supertype of this parallel collection's type parameter T.

Type parameters

U

A type parameter for the binary operator, a supertype of T.

Value parameters

op

A binary operator that must be associative.

Attributes

Returns

An option value containing result of applying reduce operator op between all the elements if the collection is nonempty, and None otherwise.

Inherited from:
ParIterableLike
def reduceRight[U >: T](op: (T, U) => U): U

Attributes

Inherited from:
ParIterableLike
def reduceRightOption[U >: T](op: (T, U) => U): Option[U]

Attributes

Inherited from:
ParIterableLike
def repr: ParSeq[T]

Attributes

Inherited from:
ParIterableLike
protected def reuse[S, That](oldc: Option[Combiner[S, That]], newc: Combiner[S, That]): Combiner[S, That]

Optionally reuses an existing combiner for better performance. By default it doesn't - subclasses may override this behaviour. The provided combiner oldc that can potentially be reused will be either some combiner from the previous computational task, or None if there was no previous phase (in which case this method must return newc).

Optionally reuses an existing combiner for better performance. By default it doesn't - subclasses may override this behaviour. The provided combiner oldc that can potentially be reused will be either some combiner from the previous computational task, or None if there was no previous phase (in which case this method must return newc).

Value parameters

newc

The new, empty combiner that can be used.

oldc

The combiner that is the result of the previous task, or None if there was no previous task.

Attributes

Returns

Either newc or oldc.

Inherited from:
ParIterableLike
def reverse: ParSeq[T]

Attributes

Inherited from:
ParSeqLike
def reverseMap[S](f: T => S): ParSeq[S]

Attributes

Inherited from:
ParSeqLike
override def sameElements[U >: T](that: IterableOnce[U]): Boolean

Attributes

Definition Classes
Inherited from:
ParSeqLike
def scan[U >: T](z: U)(op: (U, U) => U): ParSeq[U]

Computes a prefix scan of the elements of the collection.

Computes a prefix scan of the elements of the collection.

Note: The neutral element z may be applied more than once.

Type parameters

U

element type of the resulting collection

Value parameters

op

the associative operator for the scan

z

neutral element for the operator op

Attributes

Returns

a new parallel iterable containing the prefix scan of the elements in this parallel iterable

Inherited from:
ParIterableLike
def scanLeft[S](z: S)(op: (S, T) => S): Iterable[S]

Attributes

Inherited from:
ParIterableLike
def scanRight[S](z: S)(op: (T, S) => S): Iterable[S]

Attributes

Inherited from:
ParIterableLike
def segmentLength(p: T => Boolean, from: Int): Int

Returns the length of the longest segment of elements starting at a given position satisfying some predicate.

Returns the length of the longest segment of elements starting at a given position satisfying some predicate.

This method will use indexFlag signalling capabilities. This means that splitters may set and read the indexFlag state.

The index flag is initially set to maximum integer value.

Value parameters

from

the starting offset for the search

p

the predicate used to test the elements

Attributes

Returns

the length of the longest segment of elements starting at from and satisfying the predicate

Inherited from:
ParSeqLike
final def size: Int

Attributes

Inherited from:
ParSeqLike
def slice(unc_from: Int, unc_until: Int): ParSeq[T]

Attributes

Inherited from:
ParIterableLike
def span(pred: T => Boolean): (ParSeq[T], ParSeq[T])

Splits this parallel iterable into a prefix/suffix pair according to a predicate.

Splits this parallel iterable into a prefix/suffix pair according to a predicate.

This method will use indexFlag signalling capabilities. This means that splitters may set and read the indexFlag state. The index flag is initially set to maximum integer value.

Value parameters

pred

the predicate used to test the elements

Attributes

Returns

a pair consisting of the longest prefix of the collection for which all the elements satisfy pred, and the rest of the collection

Inherited from:
ParIterableLike
def splitAt(n: Int): (ParSeq[T], ParSeq[T])

Attributes

Inherited from:
ParIterableLike
def startsWith[S >: T](that: IterableOnce[S], offset: Int): Boolean

Tests whether this parallel iterable contains the given sequence at a given index.

Tests whether this parallel iterable contains the given sequence at a given index.

This method will use abort signalling capabilities. This means that splitters may send and read abort signals.

Type parameters

S

the element type of that parallel sequence

Value parameters

offset

the starting offset for the search

that

the parallel sequence this sequence is being searched for

Attributes

Returns

true if there is a sequence that starting at offset in this sequence, false otherwise

Inherited from:
ParSeqLike
def stepper[S <: Stepper[_]](implicit shape: StepperShape[T, S]): S

Attributes

Inherited from:
IterableOnce
override def stringPrefix: String

Attributes

Definition Classes
Inherited from:
ParSeq
def sum[U >: T](implicit num: Numeric[U]): U

Attributes

Inherited from:
ParIterableLike
def tail: ParSeq[T]

Attributes

Inherited from:
ParIterableLike
def take(n: Int): ParSeq[T]

Attributes

Inherited from:
ParIterableLike
def takeWhile(pred: T => Boolean): ParSeq[T]

Takes the longest prefix of elements that satisfy the predicate.

Takes the longest prefix of elements that satisfy the predicate.

This method will use indexFlag signalling capabilities. This means that splitters may set and read the indexFlag state. The index flag is initially set to maximum integer value.

Value parameters

pred

the predicate used to test the elements

Attributes

Returns

the longest prefix of this parallel iterable of elements that satisfy the predicate pred

Inherited from:
ParIterableLike

The task support object which is responsible for scheduling and load-balancing tasks to processors.

The task support object which is responsible for scheduling and load-balancing tasks to processors.

Attributes

See also
Inherited from:
ParIterableLike

Changes the task support object which is responsible for scheduling and load-balancing tasks to processors.

Changes the task support object which is responsible for scheduling and load-balancing tasks to processors.

A task support object can be changed in a parallel collection after it has been created, but only during a quiescent period, i.e. while there are no concurrent invocations to parallel collection methods.

Here is a way to change the task support of a parallel collection:

import scala.collection.parallel._
val pc = mutable.ParArray(1, 2, 3)
pc.tasksupport = new ForkJoinTaskSupport(
  new java.util.concurrent.ForkJoinPool(2))

Attributes

See also
Inherited from:
ParIterableLike
def to[C](factory: Factory[T, C]): C

Attributes

Inherited from:
ParIterableLike
def toArray[U >: T : ClassTag]: Array[U]

Attributes

Inherited from:
ParIterableLike
def toBuffer[U >: T]: Buffer[U]

Attributes

Inherited from:
ParIterableLike

Attributes

Inherited from:
ParIterableLike
override def toIterable: ParIterable[T]

Attributes

Definition Classes
Inherited from:
ParIterable

Attributes

Inherited from:
ParIterableLike
def toList: List[T]

Attributes

Inherited from:
ParIterableLike
def toMap[K, V](implicit ev: T <:< (K, V)): ParMap[K, V]

Attributes

Inherited from:
ParIterableLike
protected def toParCollection[U >: T, That](cbf: () => Combiner[U, That]): That

Attributes

Inherited from:
ParIterableLike
protected def toParMap[K, V, That](cbf: () => Combiner[(K, V), That])(implicit ev: T <:< (K, V)): That

Attributes

Inherited from:
ParIterableLike
def toSet[U >: T]: ParSet[U]

Attributes

Inherited from:
ParIterableLike
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Inherited from:
ParSeq
def toVector: Vector[T]

Attributes

Inherited from:
ParIterableLike
def transpose[B](implicit asTraversable: T => IterableOnce[B]): ParSeq[ParSeq[B]]

Transposes this collection of traversable collections into a collection of collections.

Transposes this collection of traversable collections into a collection of collections.

The resulting collection's type will be guided by the static type of collection. For example:

  val xs = List(
             Set(1, 2, 3),
             Set(4, 5, 6)).transpose
  // xs == List(
  //         List(1, 4),
  //         List(2, 5),
  //         List(3, 6))

  val ys = Vector(
             List(1, 2, 3),
             List(4, 5, 6)).transpose
  // ys == Vector(
  //         Vector(1, 4),
  //         Vector(2, 5),
  //         Vector(3, 6))

Type parameters

B

the type of the elements of each traversable collection.

Value parameters

asTraversable

an implicit conversion which asserts that the element type of this collection is a Traversable.

Attributes

Returns

a two-dimensional collection of collections which has as ''n''th row the ''n''th column of this collection.

Throws
IllegalArgumentException

if all collections in this collection are not of the same size.

Inherited from:
GenericTraversableTemplate
def union[B >: T](that: Seq[B]): ParSeq[B]

Overload of ''union'' that takes a sequential collection as parameter

Overload of ''union'' that takes a sequential collection as parameter

Attributes

Inherited from:
ParSeqLike
def union[B >: T](that: ParSeq[B]): ParSeq[B]

Produces a new sequence which contains all elements of this parallel iterable and also all elements of a given sequence. xs union ys is equivalent to xs ++ ys.

Produces a new sequence which contains all elements of this parallel iterable and also all elements of a given sequence. xs union ys is equivalent to xs ++ ys.

Another way to express this is that xs union ys computes the order-preserving multi-set union of xs and ys. union is hence a counter-part of diff and intersect which also work on multi-sets.

Note: will not terminate for infinite-sized collections.

This trait defines a new, more general split operation and reimplements the split operation of ParallelIterable trait using the new split operation.

Type parameters

B

the element type of the returned parallel iterable.

Value parameters

that

the sequence to add.

Attributes

Returns

a new parallel iterable which contains all elements of this parallel iterable followed by all elements of that.

Inherited from:
ParSeqLike
def unzip[A1, A2](implicit asPair: T => (A1, A2)): (ParSeq[A1], ParSeq[A2])

Converts this collection of pairs into two collections of the first and second half of each pair.

Converts this collection of pairs into two collections of the first and second half of each pair.

  val xs = $Coll(
             (1, "one"),
             (2, "two"),
             (3, "three")).unzip
  // xs == ($Coll(1, 2, 3),
  //        $Coll(one, two, three))

Type parameters

A1

the type of the first half of the element pairs

A2

the type of the second half of the element pairs

Value parameters

asPair

an implicit conversion which asserts that the element type of this collection is a pair.

Attributes

Returns

a pair of collections, containing the first, respectively second half of each element pair of this collection.

Inherited from:
GenericTraversableTemplate
def unzip3[A1, A2, A3](implicit asTriple: T => (A1, A2, A3)): (ParSeq[A1], ParSeq[A2], ParSeq[A3])

Converts this collection of triples into three collections of the first, second, and third element of each triple.

Converts this collection of triples into three collections of the first, second, and third element of each triple.

  val xs = $Coll(
             (1, "one", '1'),
             (2, "two", '2'),
             (3, "three", '3')).unzip3
  // xs == ($Coll(1, 2, 3),
  //        $Coll(one, two, three),
  //        $Coll(1, 2, 3))

Type parameters

A1

the type of the first member of the element triples

A2

the type of the second member of the element triples

A3

the type of the third member of the element triples

Value parameters

asTriple

an implicit conversion which asserts that the element type of this collection is a triple.

Attributes

Returns

a triple of collections, containing the first, second, respectively third member of each element triple of this collection.

Inherited from:
GenericTraversableTemplate
def updated[U >: T](index: Int, elem: U): ParSeq[U]

Attributes

Inherited from:
ParSeqLike
def withFilter(pred: T => Boolean): ParSeq[T]

Attributes

Inherited from:
ParIterableLike
protected def wrap[R](body: => R): NonDivisible[R]

Attributes

Inherited from:
ParIterableLike
override def zip[U >: T, S](that: ParIterable[S]): ParSeq[(U, S)]

Attributes

Definition Classes
Inherited from:
ParSeqLike
def zip[U >: T, S](that: Iterable[S]): ParSeq[(U, S)]

Attributes

Inherited from:
ParIterableLike
def zipAll[S, U >: T](that: ParIterable[S], thisElem: U, thatElem: S): ParSeq[(U, S)]

Attributes

Inherited from:
ParIterableLike
def zipWithIndex[U >: T]: ParSeq[(U, Int)]

Zips this parallel iterable with its indices.

Zips this parallel iterable with its indices.

Type parameters

U

the type of the first half of the returned pairs (this is always a supertype of the collection's element type T).

Attributes

Returns

A new collection of type ParIterable containing pairs consisting of all elements of this parallel iterable paired with their index. Indices start at 0.

Inherited from:
ParIterableLike

Inherited and Abstract methods

def apply(i: Int): T

Attributes

Inherited from:
ParSeq
def length: Int

Attributes

Inherited from:
ParSeqLike

Deprecated and Inherited methods

def toStream: Stream[T]

Attributes

Deprecated
true
Inherited from:
ParIterableLike

Attributes

Deprecated
true
Inherited from:
ParIterableLike

Implicits

Inherited implicits

implicit protected def builder2ops[Elem, To](cb: Builder[Elem, To]): BuilderOps[Elem, To]

Attributes

Inherited from:
ParIterableLike
implicit protected def delegatedSignalling2ops[PI <: DelegatedSignalling](it: PI): SignallingOps[PI]

Attributes

Inherited from:
ParIterableLike
implicit protected def task2ops[R, Tp](tsk: StrictSplitterCheckTask[R, Tp]): TaskOps[R, Tp]

Attributes

Inherited from:
ParIterableLike