In-place reversing.

#KT-9034
This commit is contained in:
Ilya Gorbunov
2015-10-30 18:30:25 +03:00
parent 1400bdc09a
commit 4fc54a12b8
7 changed files with 200 additions and 27 deletions
@@ -10,6 +10,7 @@ public object Collections {
public fun <T> sort(list: MutableList<T>, comparator: java.util.Comparator<in T>): Unit = java.util.sort(list, comparator)
@Deprecated("Use list.reverse() instead.", ReplaceWith("list.reverse()"))
public fun <T> reverse(list: MutableList<T>): Unit {
val size = list.size()
for (i in 0..(size / 2) - 1) {