// "Create function 'next'" "true" class FooIterator { fun hasNext(): Boolean { return false } fun next(): T { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. } } class Foo { fun iterator(): FooIterator { throw Exception("not implemented") } } fun foo() { for (i: Int in Foo()) { } }