Fix testData/js: replace deprecated usages: times, sortBy, reverse, splitBy.

This commit is contained in:
Ilya Gorbunov
2015-10-02 21:11:49 +03:00
parent 1c416ae5f3
commit 352ac58ba5
6 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ package foo
internal fun test(a: Int, b: Int): Int {
var c = 0
b.times {
repeat(b) {
c += a
}
@@ -4,7 +4,7 @@ val Int.abs: Int
get() = if (this >= 0) this else -this
fun test(xs: List<Int>): List<Int> =
xs.sortBy(comparator { a, b -> a.abs.compareTo(b.abs) })
xs.sortedWith(comparator { a, b -> a.abs.compareTo(b.abs) })
fun box(): String {
assertEquals(listOf(1, -2, 3, -4), test(listOf(-2, 1, -4, 3)))
@@ -8,7 +8,7 @@ internal fun test(a: Int, b: Int): Int {
with (a + b) {
val t = this
t.times {
repeat(t) {
res += t - b
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ package foo
internal var counter = 0
internal fun test(a: Int) {
a.times {
repeat(a) {
counter += 1
}
}
+2 -2
View File
@@ -1,8 +1,8 @@
package foo
fun box(): String {
assertEquals(listOf(7, 6, 5, 4, 3), (3..7).reverse())
assertEquals(listOf(10, 11, 12, 13), (13 downTo 10).reverse())
assertEquals(listOf(7, 6, 5, 4, 3), (3..7).reversed().toList())
assertEquals(listOf(10, 11, 12, 13), (13 downTo 10).reversed().toList())
return "OK"
}
+1 -1
View File
@@ -130,7 +130,7 @@ fun <T, C : MutableCollection<T>> Array<T>.to(result: C): C {
}
fun makeField(s: String): Field {
val lines: List<String> = s.splitBy("\n")
val lines: List<String> = s.split("\n")
val w = Collections.max<String>(lines.toList(), comparator<String> { o1, o2 ->
val l1: Int = o1.length()