Generating remove() for Iterator using same mechanism.

This commit is contained in:
Evgeny Gerashchenko
2013-09-24 17:14:17 +04:00
parent b4368ad578
commit 47b70427e1
7 changed files with 27 additions and 56 deletions
@@ -0,0 +1,13 @@
class MyIterator<T>(val v: T): Iterator<T> {
override fun next(): T = v
override fun hasNext(): Boolean = true
}
fun box(): String {
try {
(MyIterator<String>("") as MutableIterator<String>).remove()
throw AssertionError()
} catch (e: UnsupportedOperationException) {
return "OK"
}
}