KT-16602: Provide samples for sorting API usage

This commit is contained in:
Dat Trieu
2019-07-12 20:32:03 +02:00
committed by ilya-g
parent 3f5d64e635
commit 38d26b1d92
9 changed files with 180 additions and 0 deletions
@@ -6736,36 +6736,50 @@ public expect fun <T> Array<T>.plusElement(element: T): Array<T>
/**
* Sorts the array in-place.
*
* @sample samples.collections.Arrays.Sorting.sortArray
*/
public expect fun IntArray.sort(): Unit
/**
* Sorts the array in-place.
*
* @sample samples.collections.Arrays.Sorting.sortArray
*/
public expect fun LongArray.sort(): Unit
/**
* Sorts the array in-place.
*
* @sample samples.collections.Arrays.Sorting.sortArray
*/
public expect fun ByteArray.sort(): Unit
/**
* Sorts the array in-place.
*
* @sample samples.collections.Arrays.Sorting.sortArray
*/
public expect fun ShortArray.sort(): Unit
/**
* Sorts the array in-place.
*
* @sample samples.collections.Arrays.Sorting.sortArray
*/
public expect fun DoubleArray.sort(): Unit
/**
* Sorts the array in-place.
*
* @sample samples.collections.Arrays.Sorting.sortArray
*/
public expect fun FloatArray.sort(): Unit
/**
* Sorts the array in-place.
*
* @sample samples.collections.Arrays.Sorting.sortArray
*/
public expect fun CharArray.sort(): Unit
@@ -6773,6 +6787,8 @@ public expect fun CharArray.sort(): Unit
* Sorts the array in-place according to the natural order of its elements.
*
* The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.
*
* @sample samples.collections.Arrays.Sorting.sortArrayOfComparable
*/
public expect fun <T : Comparable<T>> Array<out T>.sort(): Unit
@@ -3424,6 +3424,8 @@ public inline operator fun UShortArray.plus(elements: UShortArray): UShortArray
/**
* Sorts the array in-place.
*
* @sample samples.collections.Arrays.Sorting.sortArray
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@@ -3433,6 +3435,8 @@ public fun UIntArray.sort(): Unit {
/**
* Sorts the array in-place.
*
* @sample samples.collections.Arrays.Sorting.sortArray
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@@ -3442,6 +3446,8 @@ public fun ULongArray.sort(): Unit {
/**
* Sorts the array in-place.
*
* @sample samples.collections.Arrays.Sorting.sortArray
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
@@ -3451,6 +3457,8 @@ public fun UByteArray.sort(): Unit {
/**
* Sorts the array in-place.
*
* @sample samples.collections.Arrays.Sorting.sortArray
*/
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes