8000 Update iterators.md · fsky/scala.github.com@273dba2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 273dba2

Browse files
Harish HurchurnHarish Hurchurn
authored andcommitted
Update iterators.md
Does this addition help to clarify this line at all?
1 parent 1100dcd commit 273dba2

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
@@ -26,7 +26,7 @@ As always, for-expressions can be used as an alternate syntax for expressions in
2626

2727
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

29-
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:
29+
The other operations that Iterator has in common with `Traversable` is that they have the same property. For instance, iterators provide a `map` method, which returns a new iterator:
3030

3131
scala> val it = Iterator("a", "number", "of", "words")
3232
it: Iterator[java.lang.String] = non-empty iterator

0 commit comments

Comments
 (0)
0