kotlin中判断装箱后的Int值是不是相等
扈扈哈嘿 2016-03-18 05:10:38 在kotlin的官方文档上
On the Java platform, numbers are physically stored as JVM primitive types, unless we need a nullable number reference
(e.g. Int? ) or generics are involved. In the latter cases numbers are boxed.
val a: Int = 10000
print(a === a) // Prints 'true'
val boxedA: Int? = a
val anotherBoxedA: Int? = a
print(boxedA === anotherBoxedA) // !!!Prints 'false'!!!
但是把a换成100或是左右的数字则两次都是true???