Introduce RandomAccess to JS.

Make EmptyList support RandomAccess.
#KT-10794
This commit is contained in:
Ilya Gorbunov
2016-02-10 21:23:35 +03:00
parent 6ba98f7fe6
commit ab68b49a70
4 changed files with 15 additions and 3 deletions
@@ -16,7 +16,7 @@ internal object EmptyIterator : ListIterator<Nothing> {
override fun previous(): Nothing = throw NoSuchElementException()
}
internal object EmptyList : List<Nothing>, Serializable {
internal object EmptyList : List<Nothing>, Serializable, RandomAccess {
override fun equals(other: Any?): Boolean = other is List<*> && other.isEmpty()
override fun hashCode(): Int = 1
override fun toString(): String = "[]"