Make common ArrayList declaration not open and implementing RandomAccess

This commit is contained in:
Ilya Gorbunov
2017-12-25 21:26:37 +03:00
parent fb13347864
commit c5c6eed170
2 changed files with 2 additions and 2 deletions
@@ -16,7 +16,7 @@
package kotlin.collections
expect open class ArrayList<E> : MutableList<E> {
expect class ArrayList<E> : MutableList<E>, RandomAccess {
constructor()
constructor(initialCapacity: Int)
constructor(elements: Collection<E>)
@@ -901,7 +901,7 @@ class CollectionTest {
}
@Test fun randomAccess() {
assertTrue(arrayListOf(1) is RandomAccess, "ArrayList is RandomAccess")
assertStaticAndRuntimeTypeIs<RandomAccess>(arrayListOf(1))
assertTrue(listOf(1, 2) is RandomAccess, "Default read-only list implementation is RandomAccess")
assertTrue(listOf(1) is RandomAccess, "Default singleton list is RandomAccess")
assertTrue(emptyList<Int>() is RandomAccess, "Empty list is RandomAccess")