元素统计“
This commit is contained in:
parent
662371f85d
commit
2d7b76a122
@ -30,4 +30,8 @@ fun main(args: Array<String>) {
|
|||||||
// 查找所有满足条件的元素
|
// 查找所有满足条件的元素
|
||||||
println("element > 10 = ${list.filter { it >= 20 }}")
|
println("element > 10 = ${list.filter { it >= 20 }}")
|
||||||
|
|
||||||
|
// 统计满足条件的元素个数
|
||||||
|
println("element num > 10 = ${list.count { it >= 20 }}")
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user