diff options
author | Paul Phillips <paulp@improving.org> | 2010-03-24 17:18:03 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-03-24 17:18:03 +0000 |
commit | a09cf5dbf7ed64e1ff52bebb53971d16304b58e5 (patch) | |
tree | 1fc48d708f2768e5135814bf5763c2ab87b04484 /src/library/scala/collection/TraversableLike.scala | |
parent | d43ccc679de41aca085072d96a61e363e5e23e34 (diff) | |
download | scala-a09cf5dbf7ed64e1ff52bebb53971d16304b58e5.tar.gz scala-a09cf5dbf7ed64e1ff52bebb53971d16304b58e5.tar.bz2 scala-a09cf5dbf7ed64e1ff52bebb53971d16304b58e5.zip |
Renamed partialMap to collect.
method on Iterator called collect which I had to remove, because if
the method is overloaded it puts a bullet in the type inference, an
intolerable result for a function which takes a partial function as its
argument. I don't think there's much chance of confusion, but I put a
migration warning on collect just in case. No review.
Diffstat (limited to 'src/library/scala/collection/TraversableLike.scala')
-rw-r--r-- | src/library/scala/collection/TraversableLike.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala index a09bba625f..b5b3e1c05e 100644 --- a/src/library/scala/collection/TraversableLike.scala +++ b/src/library/scala/collection/TraversableLike.scala @@ -292,13 +292,13 @@ self => * `pf` to each element on which it is defined and collecting the results. * The order of the elements is preserved. * - * @usecase def partialMap[B](pf: PartialFunction[A, B]): $Coll[B] + * @usecase def collect[B](pf: PartialFunction[A, B]): $Coll[B] * * @return a new $coll 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. */ - def partialMap[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = { + def collect[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = { val b = bf(repr) for (x <- this) if (pf.isDefinedAt(x)) b += pf(x) b.result |