inline operator fun <T> Iterator<T>.iterator(): Iterator<T>
Returns the given iterator itself. This allows to use an instance of iterator in a for
loop.
inline operator fun <K, V> Map<out K, V>.iterator(): Iterator<Entry<K, V>>
Returns an Iterator over the entries in the Map.
import kotlin.test.*
import java.util.*
fun main(args: Array<String>) {
//sampleStart
val map = mapOf("beverage" to 2.7, "meal" to 12.4, "dessert" to 5.8)
for ((key, value) in map) {
println("$key - $value") // prints: beverage - 2.7
// prints: meal - 12.4
// prints: dessert - 5.8
}
//sampleEnd
}
@JvmName("mutableIterator") inline operator fun <K, V> MutableMap<K, V>.iterator(): MutableIterator<MutableEntry<K, V>>
Platform and version requirements: JVM
Returns a MutableIterator over the mutable entries in the MutableMap.
© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/iterator.html