07ff53d456
otherwise I have to rollback dozens of files after using sed that follows conventions
36 lines
681 B
Plaintext
36 lines
681 B
Plaintext
// +JDK
|
|
import java.util.Enumeration
|
|
|
|
inline fun <T> java.util.Enumeration<T>.iterator() = object: Iterator<T> {
|
|
override val hasNext: Boolean
|
|
get() = hasMoreElements()
|
|
|
|
override fun next() = nextElement()
|
|
}
|
|
|
|
fun a(e : java.util.Enumeration<Int>) {
|
|
for (i in e) {
|
|
i : Int
|
|
}
|
|
}
|
|
|
|
fun <T : Any> T?.iterator() = object {
|
|
var hasNext = this@iterator != null
|
|
private set
|
|
|
|
fun next() : T {
|
|
if (hasNext) {
|
|
hasNext = false
|
|
return this@iterator.sure()
|
|
}
|
|
throw java.util.NoSuchElementException()
|
|
}
|
|
}
|
|
|
|
fun main(args : Array<String>) {
|
|
val i : Int? = 1
|
|
for (x in i) {
|
|
System.out?.println(x)
|
|
}
|
|
}
|