Introduce operations on Arrays returning Arrays: reversedArray, sortedArray.

#KT-8711
This commit is contained in:
Ilya Gorbunov
2015-08-28 19:05:10 +03:00
parent 89df3925fa
commit faa26cdb25
7 changed files with 426 additions and 20 deletions
@@ -615,6 +615,13 @@ public fun ShortArray.sort(comparison: (Short, Short) -> Int): Unit {
return noImpl
}
/**
* Sorts the array inplace according to the order specified by the given [comparator] object.
*/
public fun <T> Array<out T>.sortWith(comparator: Comparator<in T>): Unit {
sort { a, b -> comparator.compare(a, b) }
}
/**
* Returns a *typed* object array containing all of the elements of this primitive array.
*/