use kotlin Iterable/Iterator

instead of java Iterable/Iterator
in Kotlin code in tests
This commit is contained in:
Svetlana Isakova
2012-08-14 15:06:02 +04:00
parent 701295fc04
commit df93a26839
14 changed files with 25 additions and 30 deletions
+4 -4
View File
@@ -2,8 +2,8 @@ trait ISized {
val size : Int
}
trait javaUtilIterator<T> : java.util.Iterator<T> {
override fun remove() : Unit {
trait javaUtilIterator<T> : Iterator<T> {
fun remove() : Unit {
throw UnsupportedOperationException()
}
}
@@ -16,14 +16,14 @@ class MyIterator<T>(val array : ReadOnlyArray<T>) : javaUtilIterator<T> {
override fun next() : T = array.get(index++)
}
trait ReadOnlyArray<out T> : ISized, java.lang.Iterable<T> {
trait ReadOnlyArray<out T> : ISized, Iterable<T> {
fun get(index : Int) : T
class Default {
fun check(v: Any) = v is T
}
override fun iterator() : java.util.Iterator<T> = MyIterator<T>(this)
override fun iterator() : Iterator<T> = MyIterator<T>(this)
}
trait WriteOnlyArray<in T> : ISized {