Kotlin ArrayList等于

问题描述 投票:0回答:1

说我有一个Kotlin方法,我在其中做一个打印行来比较ArrayList<Char>的两个实例:

println("doSomething() normal equals: ${charList1 == charList2}, content compare: ${charList1.toArray().contentEquals(charList2.toArray())}")

为什么打印以下内容:

"doSomething() normal equals: false, content compare: true"

而不是:

"doSomething() normal equals: true, content compare: true"

根据Kotlin docs正常值应该起作用

list kotlin arraylist compare equals
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.