2020-01-10:Kotlin中集合遍历有哪几种方式?
Moosphan opened this issue · 3 comments
Moosphan commented
2020-01-10:Kotlin中集合遍历有哪几种方式?
424385117 commented
for,foreach,while,do while,递归,还有集合的高阶方法
yihu5566 commented
`var mutableList: MutableList = mutableListOf(1, 2, 3, 4)
// 方式1
mutableList.forEach {
println("Mutable List Elements:$it")
}
//方式和2
for (value in mutableList) {
print("value:$value")
}
//方式3
for ((index, str) in mutableList.withIndex()) {
LogUtils.d("index$index value:$str")
}
`
424385117 commented
这是来自QQ邮箱的假期自动回复邮件。
您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。