mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 08:31:29 +00:00
13 lines
328 B
Kotlin
13 lines
328 B
Kotlin
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"
|
|
}
|
|
} |