WithDefault
Attributes
Members list
Type members
Inherited classlikes
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
- Known subtypes
-
Attributes
- Inherited from:
- ParIterableLike
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- ParIterableLike
- Supertypes
Attributes
- Inherited from:
- ParMapLike
- Supertypes
-
trait ParSet[K]trait Equalstrait ParIterable[K]trait Paralleltrait IterableOnce[K]class Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- ParMapLike
- Supertypes
-
trait ParIterable[V]trait Paralleltrait IterableOnce[V]class Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- ParIterableLike
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- ParIterableLike
- Supertypes
- Known subtypes
-
Attributes
- Inherited from:
- ParIterableLike
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- ParIterableLike
- Supertypes
-
class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
Inherited types
Attributes
- Inherited from:
- ParIterableLike
Value members
Concrete methods
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
Attributes
- Definition Classes
A sequential collection containing the same elements as this collection
A sequential collection containing the same elements as this collection
Attributes
- Definition Classes
Attributes
- Definition Classes
The same map with a given default function. Note: get
, contains
, iterator
, keys
, etc are not affected by withDefault
.
The same map with a given default function. Note: get
, contains
, iterator
, keys
, etc are not affected by withDefault
.
Invoking transformer methods (e.g. map
) will not preserve the default value.
Value parameters
- d
-
the function mapping keys to values, used for non-present keys
Attributes
- Returns
-
a wrapper of the map with a default value
- Definition Classes
The same map with a given default value.
The same map with a given default value.
Invoking transformer methods (e.g. map
) will not preserve the default value.
Value parameters
- d
-
default value used for non-present keys
Attributes
- Returns
-
a wrapper of the map with a default value
- Definition Classes
Inherited methods
Attributes
- Inherited from:
- ParIterableLike
Alias for concat
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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 or0
for summation) and may be evaluated more than once
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParIterableLike
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 parameters
- K2
-
the key type of the returned parallel map.
- V2
-
the value type of the returned parallel map.
Value parameters
- pf
-
the partial function which filters and maps the parallel map.
Attributes
- 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
The factory companion object that builds instances of class ParIterable
. (or its Iterable
superclass where class ParIterable
is not a Seq
.)
The factory companion object that builds instances of class ParIterable
. (or its Iterable
superclass where class ParIterable
is not a Seq
.)
Attributes
- Definition Classes
- Inherited from:
- ParIterable
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 parameters
- that
-
the collection or iterator to append.
Attributes
- Returns
-
a new parallel map which contains all elements of this parallel map followed by all elements of
suffix
. - Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Definition Classes
- Inherited from:
- WithDefault
Attributes
- Inherited from:
- ParIterableLike
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
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 parameters
- that
-
the other map
Attributes
- Returns
-
true
if both maps contain exactly the same mappings,false
otherwise. - Definition Classes
- Inherited from:
- ParMapLike
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
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParIterableLike
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
Attributes
- Inherited from:
- ParIterableLike
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 parameters
- f
-
the function to apply to each element.
Attributes
- 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
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
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 andz
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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
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
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
Attributes
- Inherited from:
- GenericParMapTemplate
Attributes
- Inherited from:
- WithDefault
Attributes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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
-
ParMapLike -> Any
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParMapLike
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
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
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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 parameters
- f
-
the function to apply to each element.
Attributes
- 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
Attributes
- Definition Classes
- Inherited from:
- ParMap
Attributes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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, andNone
otherwise. - Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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
oroldc
. - Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- WithDefault
Attributes
- Inherited from:
- ParIterableLike
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
Attributes
- Inherited from:
- ParIterableLike
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.
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.
Attributes
- Returns
-
a parallel iterator
- Inherited from:
- WithDefault
Attributes
- Inherited from:
- IterableOnce
Attributes
- Definition Classes
- Inherited from:
- ParMap
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Definition Classes
- Inherited from:
- ParIterable
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Definition Classes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Definition Classes
- Inherited from:
- ParIterable
Attributes
- Inherited from:
- ParIterableLike
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
-
ParIterableLike -> Any
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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
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
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
Attributes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParMapLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
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
Deprecated and Inherited methods
Attributes
- Deprecated
- true
- Inherited from:
- ParIterableLike
Attributes
- Deprecated
- true
- Inherited from:
- ParIterableLike
Implicits
Inherited implicits
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike
Attributes
- Inherited from:
- ParIterableLike