分别把两个集合排序,然后进行比较
private fun isUpdate(): Boolean {
val l1 = oldList.sorted()
val l2 = newList.sorted()
if (oldList.size != newList.size) {
return true
}
return !oldList.containsAll(newList)
}
分别把两个集合排序,然后进行比较
private fun isUpdate(): Boolean {
val l1 = oldList.sorted()
val l2 = newList.sorted()
if (oldList.size != newList.size) {
return true
}
return !oldList.containsAll(newList)
}
本文标题:kotlin 两个集合内元素是否相同比较
本文链接:https://www.haomeiwen.com/subject/btjccktx.html
网友评论