Fixes and closes #4328.
No review. git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@24425 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
2934866ea5
commit
626ee80d4e
|
|
@ -455,6 +455,18 @@ self =>
|
|||
executeAndWaitResult(new Max(ord, parallelIterator) mapResult { _.get }).asInstanceOf[T]
|
||||
}
|
||||
|
||||
override def maxBy[S](f: T => S)(implicit cmp: Ordering[S]): T = {
|
||||
if (isEmpty) throw new UnsupportedOperationException("empty.maxBy")
|
||||
|
||||
reduce((x, y) => if (cmp.gteq(f(x), f(y))) x else y)
|
||||
}
|
||||
|
||||
override def minBy[S](f: T => S)(implicit cmp: Ordering[S]): T = {
|
||||
if (isEmpty) throw new UnsupportedOperationException("empty.maxBy")
|
||||
|
||||
reduce((x, y) => if (cmp.lteq(f(x), f(y))) x else y)
|
||||
}
|
||||
|
||||
override def map[S, That](f: T => S)(implicit bf: CanBuildFrom[Repr, S, That]): That = bf ifParallel { pbf =>
|
||||
executeAndWaitResult(new Map[S, That](f, pbf, parallelIterator) mapResult { _.result })
|
||||
} otherwise super.map(f)(bf)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import scala.collection.parallel.ParIterableIterator
|
|||
*
|
||||
* @author Aleksandar Prokopec
|
||||
* @since 2.9
|
||||
*
|
||||
*
|
||||
* @define Coll immutable.ParRange
|
||||
* @define coll immutable parallel range
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue