Please sign in to comment.
Fix for view isEmpty.
Views have been inheriting the very inefficient isEmpty from Traversable, and since isEmpty is not specifically forwarded to the underlying collections, views miss out on all the important optimizations in those collections which tend to be implemented via method override. Not to mention, they miss out on correctness, because calling foreach has a habit of forcing the first element of the view.
- Loading branch information...
Showing with 36 additions and 20 deletions.
- +2 −1 src/library/scala/collection/IterableLike.scala
- +1 −0 src/library/scala/collection/SeqLike.scala
- +3 −2 src/library/scala/collection/TraversableLike.scala
- +11 −2 src/library/scala/collection/TraversableViewLike.scala
- +1 −0 src/library/scala/collection/immutable/Stream.scala
- +1 −0 src/library/scala/collection/mutable/IndexedSeqLike.scala
- +15 −14 src/library/scala/collection/parallel/ParIterableLike.scala
- +2 −1 src/library/scala/collection/parallel/ParSeqLike.scala