Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2020-01-10:Kotlin中集合遍历有哪几种方式? #231

Open
Moosphan opened this issue Jan 10, 2020 · 3 comments
Open

2020-01-10:Kotlin中集合遍历有哪几种方式? #231

Moosphan opened this issue Jan 10, 2020 · 3 comments
Labels

Comments

@Moosphan
Copy link
Owner

No description provided.

@424385117
Copy link

for,foreach,while,do while,递归,还有集合的高阶方法

@yihu5566
Copy link

yihu5566 commented Jul 8, 2022

`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
Copy link

424385117 commented Jul 8, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants