Iterator.hasNext() becomes property

This commit is contained in:
Alex Tkachman
2011-10-23 20:20:41 +02:00
parent 5b1d6052d5
commit 2010d770b5
10 changed files with 157 additions and 123 deletions
@@ -88,7 +88,8 @@ class MyCollection2(): Iterable<Int> {
var k : Int = 5
override fun next() : Int = k--
override fun hasNext() = k > 0
override val hasNext : Boolean
get() = k > 0
}
}
@@ -99,7 +100,8 @@ class MyCollection3() {
var k : Int = 5
fun next() : Int? = k--
fun hasNext() = k > 0
val hasNext : Boolean
get() = k > 0
}
}