iterator

JVM
1.0
operator fun <T> Enumeration<T>.iterator(): Iterator<T>

Creates an Iterator for an java.util.Enumeration, allowing to use it in for loops.

import java.util.*

fun main(args: Array<String>) {
//sampleStart
val vector = Vector<String>().apply {
    add("RED")
    add("GREEN")
    add("BLUE")
}

// iterator() extension is called here
for (e in vector.elements()) {
    println("The element is $e")
}
//sampleEnd
}