【发布时间】:2020-02-06 07:37:44
【问题描述】:
我想从具有特定属性的列表中获取集合的计数值 提前致谢
class User(val age = 0, val group = "school")
fun main(
val list = listof(User(1, "school"), User(2, "school"), User(3, "company"))
fun getCount() {
//how to get 2 (the count of set such as ("school", "company").size)
}
}
【问题讨论】:
-
我花了 5 秒钟将您的问题输入谷歌,然后我得到了这个 -> kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/… 。在问这里之前做你的研究!
标签: kotlin collections