iterator

Platform and version requirements: 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
}

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/java.util.-enumeration/iterator.html