@@ -221,7 +221,9 @@ extension MutableCollection {
221221 /// After partitioning a collection, there is a pivot index `p` where
222222 /// no element before `p` satisfies the `belongsInSecondPartition`
223223 /// predicate and every element at or after `p` satisfies
224- /// `belongsInSecondPartition`.
224+ /// `belongsInSecondPartition`. This operation isn't guaranteed to be
225+ /// stable, so the relative ordering of elements within the partitions might
226+ /// change.
225227 ///
226228 /// In the following example, an array of numbers is partitioned by a
227229 /// predicate that matches elements greater than 30.
@@ -241,6 +243,10 @@ extension MutableCollection {
241243 /// let second = numbers[p...]
242244 /// // second == [60, 40]
243245 ///
246+ /// Note that the order of elements in both partitions changed.
247+ /// That is, `40` appears before `60` in the original collection,
248+ /// but, after calling `partition(by:)`, `60` appears before `40`.
249+ ///
244250 /// - Parameter belongsInSecondPartition: A predicate used to partition
245251 /// the collection. All elements satisfying this predicate are ordered
246252 /// after all elements not satisfying it.
@@ -285,7 +291,9 @@ extension MutableCollection where Self: BidirectionalCollection {
285291 /// After partitioning a collection, there is a pivot index `p` where
286292 /// no element before `p` satisfies the `belongsInSecondPartition`
287293 /// predicate and every element at or after `p` satisfies
288- /// `belongsInSecondPartition`.
294+ /// `belongsInSecondPartition`. This operation isn't guaranteed to be
295+ /// stable, so the relative ordering of elements within the partitions might
296+ /// change.
289297 ///
290298 /// In the following example, an array of numbers is partitioned by a
291299 /// predicate that matches elements greater than 30.
@@ -305,6 +313,10 @@ extension MutableCollection where Self: BidirectionalCollection {
305313 /// let second = numbers[p...]
306314 /// // second == [60, 40]
307315 ///
316+ /// Note that the order of elements in both partitions changed.
317+ /// That is, `40` appears before `60` in the original collection,
318+ /// but, after calling `partition(by:)`, `60` appears before `40`.
319+ ///
308320 /// - Parameter belongsInSecondPartition: A predicate used to partition
309321 /// the collection. All elements satisfying this predicate are ordered
310322 /// after all elements not satisfying it.
0 commit comments