Parallel sequences inherit the Seq trait. Their indexing and length computations
are defined to be efficient. Like their sequential counterparts
they always have a defined order of elements. This means they will produce resulting
parallel sequences in the same way sequential sequences do. However, the order
in which they perform bulk operations on elements to produce results is not defined and is generally
nondeterministic. If the higher-order functions given to them produce no sideeffects,
then this won't be noticeable.

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

[use case] Returns a new general sequence containing the elements from the left hand operand followed by the elements from the
right hand operand.

[use case]

Returns a new general sequence containing the elements from the left hand operand followed by the elements from the
right hand operand. The element type of the general sequence is the most specific superclass encompassing
the element types of the two operands.

defaggregate[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).

S

the type of accumulated results

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

seqop

an operator used to accumulate results within a partition

combop

an associative operator used to combine results from different partitions

Creates a combiner factory. Each combiner factory instance is used
once per invocation of a parallel transformer method for a single
collection.

The default combiner factory creates a new combiner every time it
is requested, unless the combiner is thread-safe as indicated by its
canBeShared method. In this case, the method returns a factory which
returns the same combiner each time. This is typically done for
concurrent parallel collections, the combiners of which allow
thread safe access.

Copies values of this general sequence to an array.
Fills the given array xs with values of this general sequence, beginning at index start.
Copying will stop once either the end of the current general sequence is reached,
or the end of the array is reached.

Copies values of this general sequence to an array.
Fills the given array xs with values of this general sequence.
Copying will stop once either the end of the current general sequence is reached,
or the end of the array is reached.

[use case] Computes the multiset difference between this general sequence and another sequence.

[use case]

Computes the multiset difference between this general sequence and another sequence.

Note: will not terminate for infinite-sized collections.

that

the sequence of elements to remove

returns

a new general sequence which contains all elements of this general sequence
except some of occurrences of elements that also appear in that.
If an element value x appears
n times in that, then the first n occurrences of x will not form
part of the result, but any following occurrences will.

Note: might return different results for different runs, unless the
underlying collection type is ordered.

n

the number of elements to drop from this general iterable collection
.

returns

a general iterable collection
consisting of all elements of this general iterable collection
except the first n ones, or else the
empty general iterable collection
, if this general iterable collection
has less than n elements.

deffold[U >: T](z: U)(op: (U, U) ⇒ U): U

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

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.

U

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

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)

op

a binary operator that must be associative

returns

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

[use case] Computes the multiset intersection between this general sequence and another sequence.

[use case]

Computes the multiset intersection between this general sequence and another sequence.

Note: may not terminate for infinite-sized collections.

that

the sequence of elements to intersect with.

returns

a new general sequence which contains all elements of this general sequence
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.

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.

Displays all elements of this general iterable collection
in a string.

Displays all elements of this general iterable collection
in a string.

returns

a string representation of this general iterable collection
. In the resulting string
the string representations (w.r.t. the method toString)
of all elements of this general iterable collection
follow each other without any
separator string.

Displays all elements of this general iterable collection
in a string using a separator string.

Displays all elements of this general iterable collection
in a string using a separator string.

sep

the separator string.

returns

a string representation of this general iterable collection
. In the resulting string
the string representations (w.r.t. the method toString)
of all elements of this general iterable collection
are separated by the string sep.

Displays all elements of this general iterable collection
in a string using start, end, and
separator strings.

Displays all elements of this general iterable collection
in a string using start, end, and
separator strings.

start

the starting string.

sep

the separator string.

end

the ending string.

returns

a string representation of this general iterable collection
. The resulting string
begins with the string start and ends with the string
end. Inside, the string representations (w.r.t. the method
toString) of all elements of this general iterable collection
are separated by
the string sep.

defpar: Repr

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.

Partitions this general iterable collection
in two general iterable collection
s according to a predicate.

Partitions this general iterable collection
in two general iterable collection
s according to a predicate.

pred

the predicate on which to partition.

returns

a pair of general iterable collection
s: the first general iterable collection
consists of all elements that
satisfy the predicate p and the second general iterable collection
consists of all elements
that don't. The relative order of the elements in the resulting general iterable collection
s
may not be preserved.

defproduct: A

[use case] Multiplies up the elements of this collection.

[use case]

Multiplies up the elements of this collection.

returns

the product of all elements in this general sequence of numbers of type Int.
Instead of Int, any other type T with an implicit Numeric[T] implementation
can be used as element type of the general sequence and as result type of product.
Examples of such types are: Long, Float, Double, BigInt.

defreduce[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.

U

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

op

A binary operator that must be associative.

returns

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

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.

U

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

op

A binary operator that must be associative.

returns

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

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).

oldc

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

defsum: A

[use case] Sums up the elements of this collection.

[use case]

Sums up the elements of this collection.

returns

the sum of all elements in this general sequence of numbers of type Int.
Instead of Int, any other type T with an implicit Numeric[T] implementation
can be used as element type of the general sequence and as result type of sum.
Examples of such types are: Long, Float, Double, BigInt.

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.

Converts this general iterable collection
to an iterable collection. Note that
the choice of target Iterable is lazy in this default implementation
as this TraversableOnce may be lazy and unevaluated (i.e. it may
be an iterator which is only traversable once).

Note: will not terminate for infinite-sized collections.

returns

an Iterable containing all elements of this general iterable collection
.

Converts this general sequence to a map. This method is unavailable unless
the elements are members of Tuple2, each ((T, U)) becoming a key-value
pair in the map. Duplicate keys will be overwritten by later keys:
if this is an unordered collection, which key is in the resulting map
is undefined.

Note: will not terminate for infinite-sized collections.

returns

a map of type immutable.Map[T, U]
containing all key/value pairs of type (T, U) of this general sequence.

[use case] Returns a general sequence formed from this general sequence and another iterable collection
by combining corresponding elements in pairs.

[use case]

Returns a general sequence formed from this general sequence and another iterable collection
by combining corresponding elements in pairs.
If one of the two collections is longer than the other, its remaining elements are ignored.

Note: might return different results for different runs, unless the
underlying collection type is ordered.

B

the type of the second half of the returned pairs

that

The iterable providing the second half of each result pair

returns

a new general sequence containing pairs consisting of
corresponding elements of this general sequence and that. The length
of the returned collection is the minimum of the lengths of this general sequence and that.

[use case] Returns a general sequence formed from this general sequence and another iterable collection
by combining corresponding elements in pairs.

[use case]

Returns a general sequence formed from this general sequence and another iterable collection
by combining corresponding elements in pairs.
If one of the two collections is shorter than the other,
placeholder elements are used to extend the shorter collection to the length of the longer.

Note: might return different results for different runs, unless the
underlying collection type is ordered.

B

the type of the second half of the returned pairs

that

The iterable providing the second half of each result pair

thisElem

the element to be used to fill up the result if this general sequence is shorter than that.

thatElem

the element to be used to fill up the result if that is shorter than this general sequence.

returns

a new general sequence containing pairs consisting of
corresponding elements of this general sequence and that. The length
of the returned collection is the maximum of the lengths of this general sequence and that.
If this general sequence is shorter than that, thisElem values are used to pad the result.
If that is shorter than this general sequence, thatElem values are used to pad the result.