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
@@ -789,6 +789,13 @@ public inline fun <T> Iterable<T>.takeWhile(predicate: (T) -> Boolean): List<T>
return list
}
/**
* Reverses elements in the collection in-place.
*/
public fun <T> MutableList<T>.reverse(): Unit {
java.util.Collections.reverse(this)
}
/**
* Returns a list with elements in reversed order.
*/