Restore and undeprecate removed Iterator.forEach().

This commit is contained in:
Ilya Gorbunov
2015-06-26 04:53:05 +03:00
parent 34f939a476
commit 6b700c4ba6
@@ -16,6 +16,13 @@ public fun <T> Enumeration<T>.iterator(): Iterator<T> = object : Iterator<T> {
*/
public fun <T> Iterator<T>.iterator(): Iterator<T> = this
/**
* Performs the given [operation] on each element of this [Iterator].
*/
public inline fun <T> Iterator<T>.forEach(operation: (T) -> Unit) : Unit {
for (element in this) operation(element)
}
/**
* Data class representing a value from a collection or sequence, along with its index in that collection or sequence.
*