You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def foreach(f: T => Unit): Unit = while (hasNext) f(next())
68
68
}
69
69
```
70
-
Because `RichIterator` is a trait, it doesn't need to implement the abstract members of AbsIterator.
70
+
This trait implements `foreach` by continually calling the provided function `f: T => Unit` on the next element (`next()`) as long as there are further elements (`while (hasNext)`). Because `RichIterator` is a trait, it doesn't need to implement the abstract members of AbsIterator.
71
71
72
72
We would like to combine the functionality of `StringIterator` and `RichIterator` into a single class.
0 commit comments