ParMapLike

trait ParMapLike[K, +V, +CC <: ([X, Y] =>> ParMap[X, Y]), +Repr <: ParMapLike[K, V, [K, V] =>> ParMap[K, V], Repr, Sequential] & ParMap[K, V], +Sequential <: Map[K, V] & MapOps[K, V, [K, V] =>> Map[K, V], Sequential]] extends ParMapLike[K, V, CC, Repr, Sequential] with ParIterableLike[(K, V), [T] =>> ParIterable[T], Repr, Sequential]
trait ParMapLike[K, V, CC, Repr, Sequential]
trait Equals
trait ParIterableLike[(K, V), [T] =>> ParIterable[T], Repr, Sequential]
trait HasNewCombiner[(K, V), Repr]
trait Parallel
trait CustomParallelizable[(K, V), Repr]
trait Parallelizable[(K, V), Repr]
trait IterableOnce[(K, V)]
class Object
trait Matchable
class Any
class ParHashMap[K, V]
trait ParMap[K, V]
class WithDefault[K, V]

Type members

Inherited classlikes

protected trait Accessor[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 Params
R

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

Tp

the representation type of the task at hand.

Inherited from
ParIterableLike
trait BuilderOps[Elem, To]
Inherited from
ParIterableLike
protected class Copy[U >: T, That](cfactory: CombinerFactory[U, That], val pit: IterableSplitter[T])
Inherited from
ParIterableLike
protected class DefaultKeySet
Inherited from
ParMapLike
protected class DefaultValuesIterable
Inherited from
ParMapLike
protected trait StrictSplitterCheckTask[R, Tp]
Inherited from
ParIterableLike
trait TaskOps[R, Tp]
Inherited from
ParIterableLike
protected trait Transformer[R, Tp]
Inherited from
ParIterableLike

Inherited types

type SSCTask[R, Tp] = StrictSplitterCheckTask[R, Tp]
Inherited from
ParIterableLike

Value members

Abstract methods

def +[U >: V](kv: (K, U)): CC[K, U]
def -(key: K): Repr
def empty: Repr

Concrete methods

override def toMap[P, Q](ev: (K, V) <:< (P, Q)): ParMap[P, Q]
Definition Classes
override def updated[U >: V](key: K, value: U): CC[K, U]
Definition Classes

Inherited methods

def ++[U >: (K, V)](that: IterableOnce[U]): ParIterable[U]
Inherited from
ParIterableLike
@inline
final def ++[V2 >: V](xs: IterableOnce[(K, V2)]): CC[K, V2]

Alias for concat

Alias for concat

Inherited from
ParMapLike
def /:[S](z: S)(op: (S, (K, V)) => S): S
Inherited from
ParIterableLike
def :\[S](z: S)(op: ((K, V), S) => S): S
Inherited from
ParIterableLike
def aggregate[S](z: => S)(seqop: (S, (K, V)) => 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 Params
S

the type of accumulated results

Value Params
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

Inherited from
ParIterableLike
def apply(key: K): V
Inherited from
ParMapLike
def canEqual(that: Any): Boolean
Inherited from
ParMapLike
def collect[S](pf: PartialFunction[(K, V), S]): ParIterable[S]
Inherited from
ParIterableLike
def collect[K2, V2](pf: PartialFunction[(K, V), (K2, V2)]): CC[K2, V2]

Builds a new collection by applying a partial function to all elements of this parallel map on which the function is defined.

Builds a new collection by applying a partial function to all elements of this parallel map on which the function is defined.

Type Params
K2

the key type of the returned parallel map.

V2

the value type of the returned parallel map.

Value Params
pf

the partial function which filters and maps the parallel map.

Returns

a new parallel map resulting from applying the given partial function pf to each element on which it is defined and collecting the results. The order of the elements is preserved.

Inherited from
ParMapLike
def concat[V2 >: V](that: IterableOnce[(K, V2)]): CC[K, V2]

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

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

Value Params
that

the collection or iterator to append.

Returns

a new parallel map which contains all elements of this parallel map followed by all elements of suffix.

Inherited from
ParMapLike
def contains(key: K): Boolean
Inherited from
ParMapLike
def copyToArray[U >: (K, V)](xs: Array[U], start: Int, len: Int): Unit
Inherited from
ParIterableLike
def copyToArray[U >: (K, V)](xs: Array[U], start: Int): Unit
Inherited from
ParIterableLike
def copyToArray[U >: (K, V)](xs: Array[U]): Unit
Inherited from
ParIterableLike
def count(p: (K, V) => Boolean): Int
Inherited from
ParIterableLike
def debugBuffer: ArrayBuffer[String]
Inherited from
ParIterableLike
def default(key: K): V
Inherited from
ParMapLike
def drop(n: Int): Repr
Inherited from
ParIterableLike
def dropWhile(pred: (K, V) => Boolean): Repr

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 Params
pred

the predicate used to test the elements

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
override def equals(that: Any): Boolean

Compares two maps structurally; i.e., checks if all mappings contained in this map are also contained in the other map, and vice versa.

Compares two maps structurally; i.e., checks if all mappings contained in this map are also contained in the other map, and vice versa.

Value Params
that

the other map

Returns

true if both maps contain exactly the same mappings, false otherwise.

Definition Classes
ParMapLike -> Equals -> Any
Inherited from
ParMapLike
def exists(p: (K, V) => 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 Params
p

a predicate used to test elements

Returns

true if p holds for some element, false otherwise

Inherited from
ParIterableLike
def filter(pred: (K, V) => Boolean): Repr
Inherited from
ParIterableLike
def filterKeys(p: K => Boolean): ParMap[K, V]
Inherited from
ParMapLike
def filterNot(pred: (K, V) => Boolean): Repr
Inherited from
ParIterableLike
def find(p: (K, V) => Boolean): Option[(K, V)]

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 Params
p

predicate used to test the elements

Returns

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

Inherited from
ParIterableLike
def flatMap[S](f: (K, V) => IterableOnce[S]): ParIterable[S]
Inherited from
ParIterableLike
def flatMap[K2, V2](f: (K, V) => IterableOnce[(K2, V2)]): CC[K2, V2]

Builds a new map by applying a function to all elements of this parallel map and using the elements of the resulting collections.

Builds a new map by applying a function to all elements of this parallel map and using the elements of the resulting collections.

Value Params
f

the function to apply to each element.

Returns

a new parallel map resulting from applying the given collection-valued function f to each element of this parallel map and concatenating the results.

Inherited from
ParMapLike
def fold[U >: (K, V)](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 Params
U

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

Value Params
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)

Returns

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

Inherited from
ParIterableLike
def foldLeft[S](z: S)(op: (S, (K, V)) => S): S
Inherited from
ParIterableLike
def foldRight[S](z: S)(op: ((K, V), S) => S): S
Inherited from
ParIterableLike
def forall(p: (K, V) => 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 Params
p

a predicate used to test elements

Returns

true if p holds for all elements, false otherwise

Inherited from
ParIterableLike
def foreach[U](f: (K, V) => 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 Params
U

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

Value Params
f

function applied to each element

Inherited from
ParIterableLike
def get(key: K): Option[V]
Inherited from
ParMapLike
def getOrElse[U >: V](key: K, default: => U): U
Inherited from
ParMapLike
def groupBy[K](f: (K, V) => K): ParMap[K, Repr]
Inherited from
ParIterableLike
def hasDefiniteSize: Boolean
Inherited from
ParIterableLike
override def hashCode(): Int
Definition Classes
ParMapLike -> Any
Inherited from
ParMapLike
def head: (K, V)
Inherited from
ParIterableLike
def headOption: Option[(K, V)]
Inherited from
ParIterableLike
def init: Repr
Inherited from
ParIterableLike
protected def initTaskSupport(): Unit
Inherited from
ParIterableLike
def isDefinedAt(key: K): Boolean
Inherited from
ParMapLike
def isEmpty: Boolean
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.

Inherited from
ParIterableLike
final def isTraversableAgain: Boolean
Inherited from
ParIterableLike
def iterator: Splitter[(K, V)]

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.

Returns

a split iterator

Inherited from
ParIterableLike
def keySet: ParSet[K]
Inherited from
ParMapLike
def keys: ParIterable[K]
Inherited from
ParMapLike
def knownSize: Int
Inherited from
IterableOnce
def last: (K, V)
Inherited from
ParIterableLike
def lastOption: Option[(K, V)]
Inherited from
ParIterableLike
def map[S](f: (K, V) => S): ParIterable[S]
Inherited from
ParIterableLike
def map[K2, V2](f: (K, V) => (K2, V2)): CC[K2, V2]

Builds a new map by applying a function to all elements of this parallel map.

Builds a new map by applying a function to all elements of this parallel map.

Value Params
f

the function to apply to each element.

Returns

a new parallel map resulting from applying the given function f to each element of this parallel map and collecting the results.

Inherited from
ParMapLike
def mapValues[S](f: V => S): ParMap[K, S]
Inherited from
ParMapLike
def max[U >: (K, V)](ord: Ordering[U]): (K, V)
Inherited from
ParIterableLike
def maxBy[S](f: (K, V) => S)(cmp: Ordering[S]): (K, V)
Inherited from
ParIterableLike
def min[U >: (K, V)](ord: Ordering[U]): (K, V)
Inherited from
ParIterableLike
def minBy[S](f: (K, V) => S)(cmp: Ordering[S]): (K, V)
Inherited from
ParIterableLike
def mkString: String
Inherited from
ParIterableLike
def mkString(sep: String): String
Inherited from
ParIterableLike
def mkString(start: String, sep: String, end: String): String
Inherited from
ParIterableLike
def nonEmpty: Boolean
Inherited from
ParIterableLike
override def par: Repr
def partition(pred: (K, V) => Boolean): (Repr, Repr)
Inherited from
ParIterableLike
def product[U >: (K, V)](num: Numeric[U]): U
Inherited from
ParIterableLike
def reduce[U >: (K, V)](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 Params
U

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

Value Params
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.

Throws
UnsupportedOperationException

if this parallel iterable is empty.

Inherited from
ParIterableLike
def reduceLeft[U >: (K, V)](op: (U, (K, V)) => U): U
Inherited from
ParIterableLike
def reduceLeftOption[U >: (K, V)](op: (U, (K, V)) => U): Option[U]
Inherited from
ParIterableLike
def reduceOption[U >: (K, V)](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 Params
U

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

Value Params
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.

Inherited from
ParIterableLike
def reduceRight[U >: (K, V)](op: ((K, V), U) => U): U
Inherited from
ParIterableLike
def reduceRightOption[U >: (K, V)](op: ((K, V), U) => U): Option[U]
Inherited from
ParIterableLike
def repr: Repr
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 Params
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.

Returns

Either newc or oldc.

Inherited from
ParIterableLike
def sameElements[U >: (K, V)](that: IterableOnce[U]): Boolean
Inherited from
ParIterableLike
def scan[U >: (K, V)](z: U)(op: (U, U) => U): ParIterable[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 Params
U

element type of the resulting collection

Value Params
op

the associative operator for the scan

z

neutral element for the operator op

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, (K, V)) => S): Iterable[S]
Inherited from
ParIterableLike
def scanRight[S](z: S)(op: ((K, V), S) => S): Iterable[S]
Inherited from
ParIterableLike
def seq: Sequential
Inherited from
ParIterableLike
def size: Int
Inherited from
ParIterableLike
def slice(unc_from: Int, unc_until: Int): Repr
Inherited from
ParIterableLike
def span(pred: (K, V) => Boolean): (Repr, Repr)

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 Params
pred

the predicate used to test the elements

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): (Repr, Repr)
Inherited from
ParIterableLike
def stepper[S <: Stepper[_]](shape: StepperShape[(K, V), S]): S
Inherited from
IterableOnce
def stringPrefix: String
Inherited from
ParIterableLike
def sum[U >: (K, V)](num: Numeric[U]): U
Inherited from
ParIterableLike
def tail: Repr
Inherited from
ParIterableLike
def take(n: Int): Repr
Inherited from
ParIterableLike
def takeWhile(pred: (K, V) => Boolean): Repr

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 Params
pred

the predicate used to test the elements

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.

See also
Inherited from
ParIterableLike
def tasksupport_=(ts: TaskSupport): Unit

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))
See also
Inherited from
ParIterableLike
def to[C](factory: Factory[(K, V), C]): C
Inherited from
ParIterableLike
def toArray[U >: (K, V)](`evidence$1`: ClassTag[U]): Array[U]
Inherited from
ParIterableLike
def toBuffer[U >: (K, V)]: Buffer[U]
Inherited from
ParIterableLike
def toIndexedSeq: IndexedSeq[(K, V)]
Inherited from
ParIterableLike
def toIterable: ParIterable[(K, V)]
Inherited from
ParIterableLike
def toIterator: Iterator[(K, V)]
Inherited from
ParIterableLike
def toList: List[(K, V)]
Inherited from
ParIterableLike
protected def toParCollection[U >: (K, V), That](cbf: () => Combiner[U, That]): That
Inherited from
ParIterableLike
protected def toParMap[K, V, That](cbf: () => Combiner[(K, V), That])(ev: (K, V) <:< (K, V)): That
Inherited from
ParIterableLike
def toSeq: ParSeq[(K, V)]
Inherited from
ParIterableLike
def toSet[U >: (K, V)]: ParSet[U]
Inherited from
ParIterableLike
override def toString: String
Definition Classes
Inherited from
ParIterableLike
def toVector: Vector[(K, V)]
Inherited from
ParIterableLike
Inherited from
ParMapLike
def withFilter(pred: (K, V) => Boolean): Repr
Inherited from
ParIterableLike
protected def wrap[R](body: => R): NonDivisible[R]
Inherited from
ParIterableLike
def zip[U >: (K, V), S](that: Iterable[S]): ParIterable[(U, S)]
Inherited from
ParIterableLike
def zip[U >: (K, V), S](that: ParIterable[S]): ParIterable[(U, S)]
Inherited from
ParIterableLike
def zipAll[S, U >: (K, V)](that: ParIterable[S], thisElem: U, thatElem: S): ParIterable[(U, S)]
Inherited from
ParIterableLike
def zipWithIndex[U >: (K, V)]: ParIterable[(U, Int)]

Zips this parallel iterable with its indices.

Zips this parallel iterable with its indices.

Type Params
U

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

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

Deprecated and Inherited methods

@deprecated("Use `to(LazyList)` instead.", "0.1.3")
def toStream: Stream[(K, V)]
Deprecated
Inherited from
ParIterableLike
@deprecated("Use `toIterable` instead", "0.1.3")
Deprecated
Inherited from
ParIterableLike

Implicits

Inherited implicits

implicit protected def builder2ops[Elem, To](cb: Builder[Elem, To]): BuilderOps[Elem, To]
Inherited from
ParIterableLike
implicit protected def delegatedSignalling2ops[PI <: DelegatedSignalling](it: PI): SignallingOps[PI]
Inherited from
ParIterableLike
implicit protected def task2ops[R, Tp](tsk: StrictSplitterCheckTask[R, Tp]): TaskOps[R, Tp]
Inherited from
ParIterableLike