Skip to content

Commit 2415288

Browse files
authored
Merge pull request #60936 from natecook1000/stable_sort
[stdlib] Document stable sort guarantee
2 parents 28ab0bd + 7ce1f3e commit 2415288

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

stdlib/public/core/Sort.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ extension Sequence where Element: Comparable {
3737
/// print(descendingStudents)
3838
/// // Prints "["Peter", "Kweku", "Kofi", "Akosua", "Abena"]"
3939
///
40-
/// The sorting algorithm is not guaranteed to be stable. A stable sort
41-
/// preserves the relative order of elements that compare equal.
40+
/// The sorting algorithm is guaranteed to be stable. A stable sort
41+
/// preserves the relative order of elements that compare as equal.
4242
///
4343
/// - Returns: A sorted array of the sequence's elements.
4444
///
@@ -117,7 +117,7 @@ extension Sequence {
117117
/// and `c` are incomparable, then `a` and `c` are also incomparable.
118118
/// (Transitive incomparability)
119119
///
120-
/// The sorting algorithm is not guaranteed to be stable. A stable sort
120+
/// The sorting algorithm is guaranteed to be stable. A stable sort
121121
/// preserves the relative order of elements for which
122122
/// `areInIncreasingOrder` does not establish an order.
123123
///
@@ -162,8 +162,8 @@ where Self: RandomAccessCollection, Element: Comparable {
162162
/// print(students)
163163
/// // Prints "["Peter", "Kweku", "Kofi", "Akosua", "Abena"]"
164164
///
165-
/// The sorting algorithm is not guaranteed to be stable. A stable sort
166-
/// preserves the relative order of elements that compare equal.
165+
/// The sorting algorithm is guaranteed to be stable. A stable sort
166+
/// preserves the relative order of elements that compare as equal.
167167
///
168168
/// - Complexity: O(*n* log *n*), where *n* is the length of the collection.
169169
@inlinable
@@ -231,7 +231,7 @@ extension MutableCollection where Self: RandomAccessCollection {
231231
/// and `c` are incomparable, then `a` and `c` are also incomparable.
232232
/// (Transitive incomparability)
233233
///
234-
/// The sorting algorithm is not guaranteed to be stable. A stable sort
234+
/// The sorting algorithm is guaranteed to be stable. A stable sort
235235
/// preserves the relative order of elements for which
236236
/// `areInIncreasingOrder` does not establish an order.
237237
///

0 commit comments

Comments
 (0)