Make IterableLike.toIterator more efficient

Override TraversableLike.toIterator which uses unnecessary toStream.

Fixes SI-4802.  Contributed by Yang Zhang.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25302 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
extempore 2011-07-16 05:51:19 +00:00
parent c36ce496ed
commit 54c8166f67
1 changed files with 2 additions and 0 deletions

View File

@ -85,6 +85,8 @@ self =>
iterator.reduceRight(op)
override /*TraversableLike*/ def toIterable: Iterable[A] =
thisCollection
override /*TraversableLike*/ def toIterator: Iterator[A] =
iterator
override /*TraversableLike*/ def head: A =
iterator.next