<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/CollectionOfOne/MutableCollection-Implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "MutableCollection Implementations"
}
-->

# MutableCollection Implementations

## Topics

### Instance Methods

[`func moveSubranges(RangeSet<Self.Index>, to: Self.Index) -> Range<Self.Index>`](/documentation/Swift/CollectionOfOne/moveSubranges(_:to:))

Moves the elements in the given subranges to just before the element at
the specified index.

[`func partition(by: (Self.Element) throws -> Bool) rethrows -> Self.Index`](/documentation/Swift/CollectionOfOne/partition(by:)-1s0cl)

Reorders the elements of the collection such that all the elements
that match the given predicate are after all the elements that don’t
match.

[`func partition(by: (Self.Element) throws -> Bool) rethrows -> Self.Index`](/documentation/Swift/CollectionOfOne/partition(by:)-2ouy4)

Reorders the elements of the collection such that all the elements
that match the given predicate are after all the elements that don’t
match.

[`func reverse()`](/documentation/Swift/CollectionOfOne/reverse())

Reverses the elements of the collection in place.

[`func shuffle()`](/documentation/Swift/CollectionOfOne/shuffle())

Shuffles the collection in place.

[`func shuffle<T>(using: inout T)`](/documentation/Swift/CollectionOfOne/shuffle(using:))

Shuffles the collection in place, using the given generator as a source
for randomness.

[`func sort()`](/documentation/Swift/CollectionOfOne/sort())

Sorts the collection in place.

[`func sort(by: (Self.Element, Self.Element) throws -> Bool) rethrows`](/documentation/Swift/CollectionOfOne/sort(by:))

Sorts the collection in place, using the given predicate as the
comparison between elements.

[`func swapAt(Self.Index, Self.Index)`](/documentation/Swift/CollectionOfOne/swapAt(_:_:))

Exchanges the values at the specified indices of the collection.

[`func withContiguousMutableStorageIfAvailable<R>((inout UnsafeMutableBufferPointer<Self.Element>) throws -> R) rethrows -> R?`](/documentation/Swift/CollectionOfOne/withContiguousMutableStorageIfAvailable(_:))

Executes a closure on the collection’s contiguous storage.

### Subscripts

[`subscript(Range<Self.Index>) -> Self.SubSequence`](/documentation/Swift/CollectionOfOne/subscript(_:)-5ny44)

[`subscript<R>(R) -> Self.SubSequence`](/documentation/Swift/CollectionOfOne/subscript(_:)-7b34k)

[`subscript(UnboundedRange) -> Self.SubSequence`](/documentation/Swift/CollectionOfOne/subscript(_:)-7lp8k)

[`subscript(Range<Self.Index>) -> Slice<Self>`](/documentation/Swift/CollectionOfOne/subscript(_:)-82bqh)

Accesses a contiguous subrange of the collection’s elements.

[`subscript(Range<Self.Index>) -> Slice<Self>`](/documentation/Swift/CollectionOfOne/subscript(_:)-8buws)

Accesses a contiguous subrange of the collection’s elements.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)