Remove overrides of equals and hashCode from AbstractCollection and AbstractMap.values, making the equality referential again.
This commit is contained in:
@@ -26,10 +26,6 @@ public abstract class AbstractCollection<out E> protected constructor() : Collec
|
||||
|
||||
override fun isEmpty(): Boolean = size == 0
|
||||
|
||||
abstract override fun hashCode(): Int
|
||||
|
||||
abstract override fun equals(other: Any?): Boolean
|
||||
|
||||
override fun toString(): String = joinToString(", ", "[", "]") {
|
||||
if (it === this) "(this Collection)" else it.toString()
|
||||
}
|
||||
|
||||
@@ -103,15 +103,6 @@ public abstract class AbstractMap<K, out V> protected constructor() : Map<K, V>
|
||||
}
|
||||
|
||||
override val size: Int get() = this@AbstractMap.size
|
||||
|
||||
// TODO: should we implement them this way? Currently it's unspecified in JVM
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is Collection<*>) return false
|
||||
return AbstractList.orderedEquals(this, other)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = AbstractList.orderedHashCode(this)
|
||||
}
|
||||
}
|
||||
return _values!!
|
||||
|
||||
Reference in New Issue
Block a user