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

# RangeReplaceableCollection Implementations

## Topics

### Operators

[`static func + <Other>(Other, Self) -> Self`](/documentation/Swift/Substring/+(_:_:)-6h592)

Creates a new collection by concatenating the elements of a sequence and a
collection.

[`static func + <Other>(Self, Other) -> Self`](/documentation/Swift/Substring/+(_:_:)-9fm63)

Creates a new collection by concatenating the elements of two collections.

[`static func + <Other>(Self, Other) -> Self`](/documentation/Swift/Substring/+(_:_:)-n335)

Creates a new collection by concatenating the elements of a collection and
a sequence.

[`static func += <Other>(inout Self, Other)`](/documentation/Swift/Substring/+=(_:_:))

Appends the elements of a sequence to a range-replaceable collection.

### Initializers

[`init<S>(S)`](/documentation/Swift/Substring/init(_:)-1ip9z)

Creates a new instance of a collection containing the elements of a
sequence.

[`init<S>(S)`](/documentation/Swift/Substring/init(_:)-6lxbv)

Creates a new instance of a collection containing the elements of a
sequence.

[`init(repeating: Self.Element, count: Int)`](/documentation/Swift/Substring/init(repeating:count:))

Creates a new collection containing the specified number of a single,
repeated value.

### Instance Methods

[`func append(Self.Element)`](/documentation/Swift/Substring/append(_:))

Adds an element to the end of the collection.

[`func append<S>(contentsOf: S)`](/documentation/Swift/Substring/append(contentsOf:))

Adds the elements of a sequence or collection to the end of this
collection.

[`func append<S>(contentsOf: S)`](/documentation/Swift/Substring/append(contentsOf:)-9folw)

Adds the elements of a sequence or collection to the end of this
collection.

[`func applying(CollectionDifference<Self.Element>) -> Self?`](/documentation/Swift/Substring/applying(_:))

Applies the given difference to this collection.

[`func filter<E>((Self.Element) throws(E) -> Bool) throws(E) -> Self`](/documentation/Swift/Substring/filter(_:)-66nvb)

Returns a new collection of the same type containing, in order, the
elements of the original collection that satisfy the given predicate.

[`func insert(Self.Element, at: Self.Index)`](/documentation/Swift/Substring/insert(_:at:))

Inserts a new element into the collection at the specified position.

[`func insert<C>(contentsOf: C, at: Self.Index)`](/documentation/Swift/Substring/insert(contentsOf:at:))

Inserts the elements of a sequence into the collection at the specified
position.

[`func popLast() -> Self.Element?`](/documentation/Swift/Substring/popLast()-70a2x)

Removes and returns the last element of the collection.

[`func popLast() -> Self.Element?`](/documentation/Swift/Substring/popLast()-nrp9)

Removes and returns the last element of the collection.

[`func remove(at: Self.Index) -> Self.Element`](/documentation/Swift/Substring/remove(at:))

Removes and returns the element at the specified position.

[`func removeAll(keepingCapacity: Bool)`](/documentation/Swift/Substring/removeAll(keepingCapacity:))

Removes all elements from the collection.

[`func removeAll(where: (Self.Element) throws -> Bool) rethrows`](/documentation/Swift/Substring/removeAll(where:))

Removes all the elements that satisfy the given predicate.

[`func removeFirst() -> Self.Element`](/documentation/Swift/Substring/removeFirst()-2cpd8)

Removes and returns the first element of the collection.

[`func removeFirst() -> Self.Element`](/documentation/Swift/Substring/removeFirst()-39om1)

Removes and returns the first element of the collection.

[`func removeFirst(Int)`](/documentation/Swift/Substring/removeFirst(_:)-43evo)

Removes the specified number of elements from the beginning of the
collection.

[`func removeFirst(Int)`](/documentation/Swift/Substring/removeFirst(_:)-5s82s)

Removes the specified number of elements from the beginning of the
collection.

[`func removeLast() -> Self.Element`](/documentation/Swift/Substring/removeLast()-4kq76)

Removes and returns the last element of the collection.

[`func removeLast() -> Self.Element`](/documentation/Swift/Substring/removeLast()-5b56p)

Removes and returns the last element of the collection.

[`func removeLast(Int)`](/documentation/Swift/Substring/removeLast(_:)-1xrzw)

Removes the specified number of elements from the end of the
collection.

[`func removeLast(Int)`](/documentation/Swift/Substring/removeLast(_:)-5ulmx)

Removes the specified number of elements from the end of the
collection.

[`func removeSubrange(Range<Self.Index>)`](/documentation/Swift/Substring/removeSubrange(_:)-8mayj)

Removes the elements in the specified subrange from the collection.

[`func removeSubrange<R>(R)`](/documentation/Swift/Substring/removeSubrange(_:)-9twoc)

Removes the elements in the specified subrange from the collection.

[`func removeSubranges(RangeSet<Self.Index>)`](/documentation/Swift/Substring/removeSubranges(_:))

Removes the elements at the given indices.

[`func replaceSubrange<C>(Range<Self.Index>, with: C)`](/documentation/Swift/Substring/replaceSubrange(_:with:)-3hke2)

Replaces the specified subrange of elements with the given collection.

[`func replaceSubrange<C>(Range<Substring.Index>, with: C)`](/documentation/Swift/Substring/replaceSubrange(_:with:)-5g58l)

Replaces the specified subrange of elements with the given collection.

[`func replaceSubrange<C, R>(R, with: C)`](/documentation/Swift/Substring/replaceSubrange(_:with:)-7293b)

Replaces the specified subrange of elements with the given collection.

[`func reserveCapacity(Int)`](/documentation/Swift/Substring/reserveCapacity(_:))

Prepares the collection to store the specified number of elements, when
doing so is appropriate for the underlying type.

---

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)