Fix array iterators to adhere to Iterator contract
#KT-17453 Fixed Change expected exceptions in tests.
This commit is contained in:
@@ -29,7 +29,7 @@ class GenerateArrayIterators(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
out.println("private class Array${s}Iterator(private val array: ${s}Array) : ${s}Iterator() {")
|
||||
out.println(" private var index = 0")
|
||||
out.println(" override fun hasNext() = index < array.size")
|
||||
out.println(" override fun next$s() = array[index++]")
|
||||
out.println(" override fun next$s() = try { array[index++] } catch (e: ArrayIndexOutOfBoundsException) { throw NoSuchElementException(e.message) }")
|
||||
out.println("}")
|
||||
out.println()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user