Make Array.size() a function instead of a property

Also add a deprecated extension property to help migration. This is done to
unify getting size of arrays and collections
This commit is contained in:
Alexander Udalov
2014-11-14 18:02:04 +03:00
parent bc238d5f4c
commit 128c938965
67 changed files with 677 additions and 625 deletions
@@ -4,7 +4,7 @@ fun IntArray.swap(i:Int, j:Int) {
this[j] = temp
}
fun IntArray.quicksort() = quicksort(0, size-1)
fun IntArray.quicksort() = quicksort(0, size()-1)
fun IntArray.quicksort(L: Int, R:Int) {
val m = this[(L + R) / 2]
@@ -34,7 +34,7 @@ fun box() : String {
a[2*i+1] = -2*i-1
}
a.quicksort()
for(i in 0..a.size-2) {
for(i in 0..a.size()-2) {
if (a[i] > a[i+1]) return "Fail $i: ${a[i]} > ${a[i+1]}"
}
return "OK"