Generating remove() for Iterator using same mechanism.
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
public class removeInIterator {
|
||||
public static void bar(java.util.Iterator<Integer> it) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fun box() : String {
|
||||
try {
|
||||
removeInIterator.bar(object : Iterator<Int> {
|
||||
public override fun hasNext(): Boolean = false
|
||||
public override fun next(): Int = 1
|
||||
})
|
||||
}
|
||||
catch (e: UnsupportedOperationException) {
|
||||
if (e.getMessage() == "Mutating method called on a Kotlin Iterator")
|
||||
return "OK"
|
||||
}
|
||||
return "fail"
|
||||
}
|
||||
Reference in New Issue
Block a user