<!--
{
  "documentType" : "article",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/UInt/Words-swift.struct/Collection-Implementations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Collection Implementations"
}
-->

# Collection Implementations

## Topics

### Instance Properties

[`var first: Self.Element?`](/documentation/Swift/UInt/Words-swift.struct/first)

The first element of the collection.

[`var isEmpty: Bool`](/documentation/Swift/UInt/Words-swift.struct/isEmpty)

A Boolean value indicating whether the collection is empty.

[`var underestimatedCount: Int`](/documentation/Swift/UInt/Words-swift.struct/underestimatedCount)

A value less than or equal to the number of elements in the collection.

### Instance Methods

[`func drop(while: (Self.Element) throws -> Bool) rethrows -> Self.SubSequence`](/documentation/Swift/UInt/Words-swift.struct/drop(while:))

Returns a subsequence by skipping elements while `predicate` returns
`true` and returning the remaining elements.

[`func dropFirst(Int) -> Self.SubSequence`](/documentation/Swift/UInt/Words-swift.struct/dropFirst(_:))

Returns a subsequence containing all but the given number of initial
elements.

[`func firstIndex(of: Self.Element) -> Self.Index?`](/documentation/Swift/UInt/Words-swift.struct/firstIndex(of:))

Returns the first index where the specified value appears in the
collection.

[`func firstIndex(where: (Self.Element) throws -> Bool) rethrows -> Self.Index?`](/documentation/Swift/UInt/Words-swift.struct/firstIndex(where:))

Returns the first index in which an element of the collection satisfies
the given predicate.

[`func formIndex(inout Self.Index, offsetBy: Int)`](/documentation/Swift/UInt/Words-swift.struct/formIndex(_:offsetBy:))

Offsets the given index by the specified distance.

[`func formIndex(inout Self.Index, offsetBy: Int, limitedBy: Self.Index) -> Bool`](/documentation/Swift/UInt/Words-swift.struct/formIndex(_:offsetBy:limitedBy:))

Offsets the given index by the specified distance, or so that it equals
the given limiting index.

[`func formIndex(after: inout Self.Index)`](/documentation/Swift/UInt/Words-swift.struct/formIndex(after:))

Replaces the given index with its successor.

[`func index(of: Self.Element) -> Self.Index?`](/documentation/Swift/UInt/Words-swift.struct/index(of:))

Returns the first index where the specified value appears in the
collection.

[`func indices(of: Self.Element) -> RangeSet<Self.Index>`](/documentation/Swift/UInt/Words-swift.struct/indices(of:))

Returns the indices of all the elements that are equal to the given
element.

[`func indices(where: (Self.Element) throws -> Bool) rethrows -> RangeSet<Self.Index>`](/documentation/Swift/UInt/Words-swift.struct/indices(where:))

Returns the indices of all the elements that match the given predicate.

[`func makeIterator() -> IndexingIterator<Self>`](/documentation/Swift/UInt/Words-swift.struct/makeIterator())

Returns an iterator over the elements of the collection.

[`func map<T, E>((Self.Element) throws(E) -> T) throws(E) -> [T]`](/documentation/Swift/UInt/Words-swift.struct/map(_:)-2w7k9)

Returns an array containing the results of mapping the given closure
over the sequence’s elements.

[`func prefix(Int) -> Self.SubSequence`](/documentation/Swift/UInt/Words-swift.struct/prefix(_:))

Returns a subsequence, up to the specified maximum length, containing
the initial elements of the collection.

[`func prefix(through: Self.Index) -> Self.SubSequence`](/documentation/Swift/UInt/Words-swift.struct/prefix(through:))

Returns a subsequence from the start of the collection through the
specified position.

[`func prefix(upTo: Self.Index) -> Self.SubSequence`](/documentation/Swift/UInt/Words-swift.struct/prefix(upTo:))

Returns a subsequence from the start of the collection up to, but not
including, the specified position.

[`func prefix(while: (Self.Element) throws -> Bool) rethrows -> Self.SubSequence`](/documentation/Swift/UInt/Words-swift.struct/prefix(while:))

Returns a subsequence containing the initial elements until `predicate`
returns `false` and skipping the remaining elements.

[`func randomElement() -> Self.Element?`](/documentation/Swift/UInt/Words-swift.struct/randomElement())

Returns a random element of the collection.

[`func randomElement<T>(using: inout T) -> Self.Element?`](/documentation/Swift/UInt/Words-swift.struct/randomElement(using:))

Returns a random element of the collection, using the given generator as
a source for randomness.

[`func removingSubranges(RangeSet<Self.Index>) -> DiscontiguousSlice<Self>`](/documentation/Swift/UInt/Words-swift.struct/removingSubranges(_:))

Returns a collection of the elements in this collection that are not
represented by the given range set.

[`func split(maxSplits: Int, omittingEmptySubsequences: Bool, whereSeparator: (Self.Element) throws -> Bool) rethrows -> [Self.SubSequence]`](/documentation/Swift/UInt/Words-swift.struct/split(maxSplits:omittingEmptySubsequences:whereSeparator:))

Returns the longest possible subsequences of the collection, in order,
that don’t contain elements satisfying the given predicate.

[`func split(separator: Self.Element, maxSplits: Int, omittingEmptySubsequences: Bool) -> [Self.SubSequence]`](/documentation/Swift/UInt/Words-swift.struct/split(separator:maxSplits:omittingEmptySubsequences:))

Returns the longest possible subsequences of the collection, in order,
around elements equal to the given element.

[`func suffix(from: Self.Index) -> Self.SubSequence`](/documentation/Swift/UInt/Words-swift.struct/suffix(from:))

Returns a subsequence from the specified position to the end of the
collection.

---

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)