`def foreach(f: T => Unit): Unit = while (hasNext) f(next())` This should be explained more clearly. Currently this syntax is very confusing to a new learner of scala. This is part of this page - http://docs.scala-lang.org/tour/mixin-class-composition.html