From e7bd89e2638d469075d6ab545287e7a7254232c6 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Tue, 26 Sep 2017 19:12:39 +0300 Subject: [PATCH] stdlib: Implement equals function for AbstractMutableList --- .../src/main/kotlin/kotlin/collections/AbstractList.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runtime/src/main/kotlin/kotlin/collections/AbstractList.kt b/runtime/src/main/kotlin/kotlin/collections/AbstractList.kt index 35547f84260..30705c43884 100644 --- a/runtime/src/main/kotlin/kotlin/collections/AbstractList.kt +++ b/runtime/src/main/kotlin/kotlin/collections/AbstractList.kt @@ -222,6 +222,15 @@ public abstract class AbstractMutableList protected constructor() : AbstractM } } + override fun equals(other: Any?): Boolean { + if (other === this) return true + if (other !is List<*>) return false + + return AbstractList.orderedEquals(this, other) + } + + override fun hashCode(): Int = AbstractList.orderedHashCode(this) + private open inner class IteratorImpl : MutableIterator { /** the index of the item that will be returned on the next call to [next]`()` */ protected var index = 0