8000 Merge pull request #368 from Harish-Hurchurn/patch-1 · avramirez/scala.github.com@8eebd7f · GitHub
[go: up one dir, main page]

Skip to content

Commit 8eebd7f

Browse files
committed
Merge pull request scala#368 from Harish-Hurchurn/patch-1
Update iterators.md
2 parents fffbac9 + 7ec8c01 commit 8eebd7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

overviews/collections/iterators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ As always, for-expressions can be used as an alternate syntax for expressions in
2424

2525
for (elem <- it) println(elem)
2626

27-
There's an important difference between the foreach method on iterators and the same method on traversable collections: When called to an iterator, `foreach` will leave the iterator at its end when it is done. So calling `next` again on the same iterator will fail with a `NoSuchElementException`. By contrast, when called on on a collection, `foreach` leaves the number of elements in the collection unchanged (unless the passed function adds to removes elements, but this is discouraged, because it may lead to surprising results).
27+
There's an important difference between the foreach method on iterators and the same method on traversable collections: When called on an iterator, `foreach` will leave the iterator at its end when it is done. So calling `next` again on the same iterator will fail with a `NoSuchElementException`. By contrast, when called on on a collection, `foreach` leaves the number of elements in the collection unchanged (unless the passed function adds to removes elements, but this is discouraged, because it may lead to surprising results).
2828

2929
The other operations that Iterator has in common with `Traversable` have the same property. For instance, iterators provide a `map` method, which returns a new iterator:
3030

0 commit comments

Comments
 (0)
0