summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/immutable/DefaultMap.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-10-31 11:52:14 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-10-31 11:52:14 +0100
commit7d09097aac4a3f0e802fdbc539014ec6018efd79 (patch)
treefa2327f74226d7a59811203c1b6064321a26a637 /src/library/scala/collection/immutable/DefaultMap.scala
parentc38235fd44f1ccb280e31a2f34f58deb59c5b2ee (diff)
downloadscala-7d09097aac4a3f0e802fdbc539014ec6018efd79.tar.gz
scala-7d09097aac4a3f0e802fdbc539014ec6018efd79.tar.bz2
scala-7d09097aac4a3f0e802fdbc539014ec6018efd79.zip
Collections: remove redundant calls to .seq
Students of Scala's history might recall that at introduction of parallel collections, GenIterable et al were *not* added; instead the parallel collections inherited from the existing interfaces. This of course was an invitation to widespread disaster as any existing code that foreach-ed over a collection might now experience unwanted concurrency. The first attempt to fix this was to add the `.seq` method to convert a parallel colleciton to a sequential one. This was added in e579152f732, and call sites in the standard library with side-effecting foreach calls were changed to use that. But this was (rightly) deemed inadequate, as we could hardly expect people to change existing code or remember to do this in new code. So later, in 3de96153e5b, GenIterable was sprouted, and parallel collections were re-parented. This commit removes residual needless calls to .seq when the static type of the receiver is already a plain Iterable, which are no-ops.
Diffstat (limited to 'src/library/scala/collection/immutable/DefaultMap.scala')
-rwxr-xr-xsrc/library/scala/collection/immutable/DefaultMap.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/library/scala/collection/immutable/DefaultMap.scala b/src/library/scala/collection/immutable/DefaultMap.scala
index ce34b84486..e9b277b9c4 100755
--- a/src/library/scala/collection/immutable/DefaultMap.scala
+++ b/src/library/scala/collection/immutable/DefaultMap.scala
@@ -46,7 +46,7 @@ trait DefaultMap[A, +B] extends Map[A, B] { self =>
*/
override def - (key: A): Map[A, B] = {
val b = newBuilder
- for (kv <- this.seq ; if kv._1 != key) b += kv
+ for (kv <- this ; if kv._1 != key) b += kv
b.result()
}
}