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

# RangeReplaceableCollection Implementations

## Topics

### Operators

[`static func + <Other>(Self, Other) -> Self`](/documentation/Swift/Slice/+(_:_:)-298al)

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

[`static func + <Other>(Other, Self) -> Self`](/documentation/Swift/Slice/+(_:_:)-4resp)

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

[`static func + <Other>(Self, Other) -> Self`](/documentation/Swift/Slice/+(_:_:)-99wuu)

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

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

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

### Initializers

[`init()`](/documentation/Swift/Slice/init())

Creates a new, empty collection.

[`init<S>(S)`](/documentation/Swift/Slice/init(_:))

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

[`init<S>(S)`](/documentation/Swift/Slice/init(_:)-81eoy)

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

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

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

[`init(repeating: Self.Element, count: Int)`](/documentation/Swift/Slice/init(repeating:count:)-6ps2q)

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

### Instance Methods

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

Adds an element to the end of the collection.

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

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

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

Applies the given difference to this collection.

[`func filter<E>((Self.Element) throws(E) -> Bool) throws(E) -> Self`](/documentation/Swift/Slice/filter(_:)-9rk6d)

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

[`func insert(Base.Element, at: Slice<Base>.Index)`](/documentation/Swift/Slice/insert(_:at:)-6sg0)

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

[`func insert(Self.Element, at: Self.Index)`](/documentation/Swift/Slice/insert(_:at:)-8i1dc)

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

[`func insert<S>(contentsOf: S, at: Slice<Base>.Index)`](/documentation/Swift/Slice/insert(contentsOf:at:)-25pep)

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

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

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

[`func popLast() -> Self.Element?`](/documentation/Swift/Slice/popLast()-30m9y)

Removes and returns the last element of the collection.

[`func popLast() -> Self.Element?`](/documentation/Swift/Slice/popLast()-4rely)

Removes and returns the last element of the collection.

[`func remove(at: Slice<Base>.Index) -> Base.Element`](/documentation/Swift/Slice/remove(at:)-7ep9e)

Removes and returns the element at the specified position.

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

Removes and returns the element at the specified position.

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

Removes all elements from the collection.

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

Removes all the elements that satisfy the given predicate.

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

Removes all the elements that satisfy the given predicate.

[`func removeFirst() -> Self.Element`](/documentation/Swift/Slice/removeFirst()-1iayr)

Removes and returns the first element of the collection.

[`func removeFirst() -> Self.Element`](/documentation/Swift/Slice/removeFirst()-3eija)

Removes and returns the first element of the collection.

[`func removeFirst(Int)`](/documentation/Swift/Slice/removeFirst(_:)-1pxgx)

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

[`func removeFirst(Int)`](/documentation/Swift/Slice/removeFirst(_:)-7hjja)

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

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

Removes and returns the last element of the collection.

[`func removeLast() -> Self.Element`](/documentation/Swift/Slice/removeLast()-wsbc)

Removes and returns the last element of the collection.

[`func removeLast(Int)`](/documentation/Swift/Slice/removeLast(_:)-75mgx)

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

[`func removeLast(Int)`](/documentation/Swift/Slice/removeLast(_:)-fxm2)

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

[`func removeSubrange<R>(R)`](/documentation/Swift/Slice/removeSubrange(_:)-1y2qo)

Removes the elements in the specified subrange from the collection.

[`func removeSubrange(Range<Slice<Base>.Index>)`](/documentation/Swift/Slice/removeSubrange(_:)-7s7x9)

Removes the specified subrange of elements from the collection.

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

Removes the elements in the specified subrange from the collection.

[`func removeSubranges(RangeSet<Self.Index>)`](/documentation/Swift/Slice/removeSubranges(_:)-2ncra)

Removes the elements at the given indices.

[`func replaceSubrange<C>(Range<Self.Index>, with: C)`](/documentation/Swift/Slice/replaceSubrange(_:with:)-8l6gb)

Replaces the specified subrange of elements with the given collection.

[`func replaceSubrange<C, R>(R, with: C)`](/documentation/Swift/Slice/replaceSubrange(_:with:)-9le44)

Replaces the specified subrange of elements with the given collection.

[`func replaceSubrange<C>(Range<Slice<Base>.Index>, with: C)`](/documentation/Swift/Slice/replaceSubrange(_:with:)-zwfk)

Replaces the specified subrange of elements with the given collection.

[`func reserveCapacity(Int)`](/documentation/Swift/Slice/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)