diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2012-10-09 15:45:35 -0700 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2012-10-09 15:45:35 -0700 |
commit | 7a6905dc158a7a543ba3f4ddeeffe538580958d3 (patch) | |
tree | ce1997312fa0f2a3023963db6ddb2cc17539334c /src/library | |
parent | 859ec02495993f225647df50397b042a3172351b (diff) | |
download | scala-7a6905dc158a7a543ba3f4ddeeffe538580958d3.tar.gz scala-7a6905dc158a7a543ba3f4ddeeffe538580958d3.tar.bz2 scala-7a6905dc158a7a543ba3f4ddeeffe538580958d3.zip |
SI-6440: Revert change to `TraversableLike.filterNot`
Commit df9f470f14262b9b1002f022c2620d8c38835805 introduced
a change to `TraversableLike.filterNot` which broke Stream
implementation that does override `filter` implementation
but does not override `filterNot` implementation. This shows
clearly that reusing code for strict and non-strict collections
is very problematic.
Added a test-case covering this problem.
Closes SI-6440.
Review by @retronym.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/TraversableLike.scala | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala index ce0b130b86..7849f1c544 100644 --- a/src/library/scala/collection/TraversableLike.scala +++ b/src/library/scala/collection/TraversableLike.scala @@ -271,12 +271,7 @@ trait TraversableLike[+A, +Repr] extends Any * @return a new $coll consisting of all elements of this $coll that do not satisfy the given * predicate `p`. The order of the elements is preserved. */ - def filterNot(p: A => Boolean): Repr = { - val b = newBuilder - for (x <- this) - if (!p(x)) b += x - b.result - } + def filterNot(p: A => Boolean): Repr = filter(!p(_)) def collect[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = { val b = bf(repr) |