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
@@ -1016,8 +1016,12 @@ object ArrayOps : TemplateGroupBase() {
typeParam("T : Comparable<T>")
doc { "Sorts the array in-place according to the natural order of its elements." }
appendStableSortNote()
specialFor(ArraysOfObjects) {
sample("samples.collections.Arrays.Sorting.sortArrayOfComparable")
}
specialFor(ArraysOfPrimitives, ArraysOfUnsigned) {
doc { "Sorts the array in-place." }
sample("samples.collections.Arrays.Sorting.sortArray")
}
returns("Unit")
@@ -1143,6 +1147,7 @@ object ArrayOps : TemplateGroupBase() {
specialFor(ArraysOfObjects) {
appendStableSortNote()
}
sample("samples.collections.Arrays.Sorting.sortRangeOfComparable")
returns("Unit")
body {
"java.util.Arrays.sort(this, fromIndex, toIndex)"