简单迭代器

数组和集合 / 迭代器

val list = listOf(1, 2, 3)
val iterator = list.iterator()

while (iterator.hasNext()) {
    println(iterator.next())
}