removed some warnings and reduntant code
This commit is contained in:
@@ -156,15 +156,11 @@ inline fun <T> java.lang.Iterable<T>.toList() : List<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline fun <T> java.util.Collection<T>.toArray() : Array<T> {
|
inline fun <T> java.util.Collection<T>.toArray() : Array<T> {
|
||||||
if (this is Array<T>)
|
val answer = Array<T>(this.size)
|
||||||
return this
|
var idx = 0
|
||||||
else {
|
for (elem in this)
|
||||||
val answer = Array<T>(this.size)
|
answer[idx++] = elem
|
||||||
var idx = 0
|
return answer as Array<T>
|
||||||
for (elem in this)
|
|
||||||
answer[idx++] = elem
|
|
||||||
return answer as Array<T>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ fun fails(block: fun() : Any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun todo(block: fun(): Any) {
|
fun todo(block: fun(): Any) {
|
||||||
println("TODO at " + Exception().getStackTrace()?.get(1))
|
println("TODO at " + Exception().getStackTrace()?.get(1) + " for " + block)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class CollectionTest() : TestSupport() {
|
|||||||
|
|
||||||
fun testForeach() {
|
fun testForeach() {
|
||||||
var count = 0
|
var count = 0
|
||||||
val x = data.foreach{ count += it.length }
|
data.foreach{ count += it.length }
|
||||||
assertEquals(6, count)
|
assertEquals(6, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user