Removed toArray() from collections (few tests are still failing).

#KT-3352 in progress
This commit is contained in:
Evgeny Gerashchenko
2013-09-25 03:01:47 +04:00
parent 48625dd7b6
commit d56c59d9d7
162 changed files with 21 additions and 75 deletions
@@ -3,8 +3,6 @@ class MyCollection<T>: Collection<T> {
override fun isEmpty(): Boolean = true
override fun contains(o: Any?): Boolean = false
override fun iterator(): Iterator<T> = throw UnsupportedOperationException()
override fun toArray(): Array<Any?> = throw UnsupportedOperationException()
override fun <E> toArray(a: Array<out E>): Array<E> = throw UnsupportedOperationException()
override fun containsAll(c: Collection<Any?>): Boolean = false
override fun hashCode(): Int = 0
override fun equals(other: Any?): Boolean = false
@@ -3,8 +3,6 @@ class MyList<T>: List<T> {
override fun isEmpty(): Boolean = true
override fun contains(o: Any?): Boolean = false
override fun iterator(): Iterator<T> = throw Error()
override fun toArray(): Array<Any?> = throw Error()
override fun <E> toArray(a: Array<out E>): Array<E> = throw Error()
override fun containsAll(c: Collection<Any?>): Boolean = false
override fun get(index: Int): T = throw IndexOutOfBoundsException()
override fun indexOf(o: Any?): Int = -1
@@ -3,8 +3,6 @@ class MyList<T>(val v: T): List<T> {
override fun isEmpty(): Boolean = true
override fun contains(o: Any?): Boolean = false
override fun iterator(): Iterator<T> = throw Error()
override fun toArray(): Array<Any?> = throw Error()
override fun <E> toArray(a: Array<out E>): Array<E> = throw Error()
override fun containsAll(c: Collection<Any?>): Boolean = false
override fun get(index: Int): T = v
override fun indexOf(o: Any?): Int = -1
@@ -16,8 +16,6 @@ class MyList<T>(v: T): Super<T>(v), List<T> {
override fun isEmpty(): Boolean = true
override fun contains(o: Any?): Boolean = false
override fun iterator(): Iterator<T> = throw Error()
override fun toArray(): Array<Any?> = throw Error()
override fun <E> toArray(a: Array<out E>): Array<E> = throw Error()
override fun containsAll(c: Collection<Any?>): Boolean = false
override fun get(index: Int): T = v
override fun indexOf(o: Any?): Int = -1
@@ -3,8 +3,6 @@ class MyList: List<String> {
override fun isEmpty(): Boolean = true
override fun contains(o: Any?): Boolean = false
override fun iterator(): Iterator<String> = throw Error()
override fun toArray(): Array<Any?> = throw Error()
override fun <E> toArray(a: Array<out E>): Array<E> = throw Error()
override fun containsAll(c: Collection<Any?>): Boolean = false
override fun get(index: Int): String = throw IndexOutOfBoundsException()
override fun indexOf(o: Any?): Int = -1
@@ -15,7 +15,6 @@ fun <T> testCollectionIterator(c: Collection<T>) {
assertEquals(1, it.next())
}
}
fun <T> testCollectionToArray(c: Collection<T>) = assertEquals(1, c.toArray()[0])
fun <T> testCollectionContainsAll(c: Collection<T>) = assertTrue(c.containsAll(c))
fun <T> testMutableCollectionAdd(c: MutableCollection<T>, t: T) {
c.add(t)
@@ -60,7 +59,6 @@ fun testCollection() {
testCollectionIsEmpty(arrayList<String>())
testCollectionContains(arrayList(1))
testCollectionIterator(arrayList(1))
testCollectionToArray(arrayList(1))
testCollectionContainsAll(arrayList("a", "b"))
testMutableCollectionAdd(arrayList(), "")