<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/UnsafeMutableRawBufferPointer/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/UnsafeMutableRawBufferPointer/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/UnsafeMutableRawBufferPointer/partition(by:)-33su4)

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/UnsafeMutableRawBufferPointer/partition(by:)-90pny)

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/UnsafeMutableRawBufferPointer/reverse())

Reverses the elements of the collection in place.

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

Shuffles the collection in place.

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

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

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

Sorts the collection in place.

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

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

[`func swapAt(Int, Int)`](/documentation/Swift/UnsafeMutableRawBufferPointer/swapAt(_:_:))

Exchanges the byte values at the specified indices
in this buffer’s memory.

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

Executes a closure on the collection’s contiguous storage.

### Subscripts

[`subscript(Range<Self.Index>) -> Slice<Self>`](/documentation/Swift/UnsafeMutableRawBufferPointer/subscript(_:)-3g42)

Accesses a contiguous subrange of the collection’s elements.

[`subscript(Range<Self.Index>) -> Slice<Self>`](/documentation/Swift/UnsafeMutableRawBufferPointer/subscript(_:)-3i1y)

Accesses a contiguous subrange of the collection’s elements.

[`subscript<R>(R) -> Self.SubSequence`](/documentation/Swift/UnsafeMutableRawBufferPointer/subscript(_:)-3kwnc)

[`subscript(UnboundedRange) -> Self.SubSequence`](/documentation/Swift/UnsafeMutableRawBufferPointer/subscript(_:)-3pmfu)

[`subscript(Range<Self.Index>) -> Self.SubSequence`](/documentation/Swift/UnsafeMutableRawBufferPointer/subscript(_:)-9v9lo)

[`subscript(Int) -> UnsafeMutableRawBufferPointer.Element`](/documentation/Swift/UnsafeMutableRawBufferPointer/subscript(_:)-u791)

Accesses the byte at the given offset in the memory region as a `UInt8`
value.

[`subscript(Range<Int>) -> UnsafeMutableRawBufferPointer.SubSequence`](/documentation/Swift/UnsafeMutableRawBufferPointer/subscript(_:)-znv7)

Accesses the bytes in the specified memory region.

---

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)