ParSetLike

A template trait for parallel sets. This trait is mixed in with concrete
parallel sets to override the representation type.

The higher-order functions passed to certain operations may contain side-effects. Since implementations
of bulk operations may not be sequential, this means that side-effects may not be predictable and may
produce data-races, deadlocks or invalidation of state if care is not taken. It is up to the programmer
to either avoid using side-effects or to use some form of synchronization when accessing mutable data.

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

Creates a new parallel iterator used to traverse the elements of this parallel collection.
This iterator is more specific than the iterator of the returned by iterator, and augmented
with additional accessor and transformer methods.

Equivalent to x.hashCode except for boxed numeric types and null.
For numerics, it returns a hash value which is consistent
with value equality: if two value type instances compare
as true, then ## will produce the same hash value for each
of them.
For null returns a hashcode where null.hashCode throws a
NullPointerException.

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

[use case]

Returns a new general set containing the elements from the left hand operand followed by the elements from the
right hand operand. The element type of the general set 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 list, while combop
would concatenate two lists 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)

seqop

an operator used to accumulate results within a partition

combop

an associative operator used to combine results from different partitions

final defasInstanceOf[T0]: T0

Cast the receiver object to be of type T0.

Cast the receiver object to be of type T0.

Note that the success of a cast at runtime is modulo Scala's erasure semantics.
Therefore the expression 1.asInstanceOf[String] will throw a ClassCastException at
runtime, while the expression List(1).asInstanceOf[List[String]] will not.
In the latter example, because the type argument is erased as part of compilation it is
not possible to check whether the contents of the list are of the requested type.

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 set to an array.
Fills the given array xs with values of this general set, beginning at index start.
Copying will stop once either the end of the current general set is reached,
or the end of the array is reached.

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

Tests whether the argument (arg0) is a reference to the receiver object (this).

Tests whether the argument (arg0) is a reference to the receiver object (this).

The eq method implements an equivalence relation on
non-null instances of AnyRef, and has three additional properties:

It is consistent: for any non-null instances x and y of type AnyRef, multiple invocations of
x.eq(y) consistently returns true or consistently returns false.

For any non-null instance x of type AnyRef, x.eq(null) and null.eq(x) returns false.

null.eq(null) returns true.

When overriding the equals or hashCode methods, it is important to ensure that their behavior is
consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2), they
should be equal to each other (o1 == o2) and they should hash to the same value (o1.hashCode == o2.hashCode).

returns

true if the argument is a reference to the receiver object; false otherwise.

Note: This operation contains an unchecked cast: if that
is a set, it will assume with an unchecked cast
that it has the same element type as this set.
Any subsequent ClassCastException is treated as a false result.

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

Note that the result of the test is modulo Scala's erasure semantics.
Therefore the expression 1.isInstanceOf[String] will return false, while the
expression List(1).isInstanceOf[List[String]] will return true.
In the latter example, because the type argument is erased as part of compilation it is
not possible to check whether the contents of the list are of the specified type.

returns

true if the receiver object is an instance of erasure of type T0; false otherwise.

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.

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

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

Displays all elements of this general set 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 set. 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 set are separated by
the string sep.

Wakes up all threads that are waiting on the receiver object's monitor.

Wakes up all threads that are waiting on the receiver object's monitor.

Definition Classes

AnyRef

Note

not specified by SLS as a member of AnyRef

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 set in two general sets according to a predicate.

Partitions this general set in two general sets according to a predicate.

pred

the predicate on which to partition.

returns

a pair of general sets: the first general set consists of all elements that
satisfy the predicate p and the second general set consists of all elements
that don't. The relative order of the elements in the resulting general sets
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 set 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 set 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 set 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 set 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 set 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).

Converts this general set 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 set.

Creates a String representation of this object. The default
representation is platform dependent. On the java platform it
is the concatenation of the class name, "@", and the object's
hashcode in hexadecimal.

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

[use case]

Returns a general set formed from this general set 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 set containing pairs consisting of
corresponding elements of this general set and that. The length
of the returned collection is the minimum of the lengths of this general set and that.

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

[use case]

Returns a general set formed from this general set 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 set is shorter than that.

thatElem

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

returns

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

This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.To access this member you can use a type ascription:

This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.To access this member you can use a type ascription:

This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.To access this member you can use a type ascription:

This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.To access this member you can use a type ascription: