var count: Int
The number of elements in the collection.
var first: Self.Element?
The first element of the collection.
var isEmpty: Bool
A Boolean value indicating whether the collection is empty.
var underestimatedCount: Int
A value less than or equal to the number of elements in the collection.
subscript<R>(R) -> Self.SubSequence
Accesses the contiguous subrange of the collection’s elements specified by a range expression.
subscript((UnboundedRange_) -> ()) -> Self.SubSequence
subscript(RangeSet<Self.Index>) -> DiscontiguousSlice<Self>
Accesses a view of this collection with the elements at the given indices.
func distance(from: Self.Index, to: Self.Index) -> Int
Returns the distance between two indices.
func drop(while: (Self.Element) throws -> Bool) rethrows -> Self.SubSequence
Returns a subsequence by skipping elements while predicate
returns true
and returning the remaining elements.
func dropFirst(Int) -> Self.SubSequence
Returns a subsequence containing all but the given number of initial elements.
func dropLast(Int) -> Self.SubSequence
Returns a subsequence containing all but the specified number of final elements.
func firstIndex(where: (Self.Element) throws -> Bool) rethrows -> Self.Index?
Returns the first index in which an element of the collection satisfies the given predicate.
func formIndex(inout Self.Index, offsetBy: Int)
Offsets the given index by the specified distance.
func formIndex(inout Self.Index, offsetBy: Int, limitedBy: Self.Index) -> Bool
Offsets the given index by the specified distance, or so that it equals the given limiting index.
func formIndex(after: inout Self.Index)
Replaces the given index with its successor.
func index(Self.Index, offsetBy: Int) -> Self.Index
Returns an index that is the specified distance from the given index.
func index(Self.Index, offsetBy: Int, limitedBy: Self.Index) -> Self.Index?
Returns an index that is the specified distance from the given index, unless that distance is beyond a given limiting index.
func map<T, E>((Self.Element) throws(E) -> T) throws(E) -> [T]
Returns an array containing the results of mapping the given closure over the sequence’s elements.
func prefix(Int) -> Self.SubSequence
Returns a subsequence, up to the specified maximum length, containing the initial elements of the collection.
func prefix(through: Self.Index) -> Self.SubSequence
Returns a subsequence from the start of the collection through the specified position.
func prefix(upTo: Self.Index) -> Self.SubSequence
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
Returns a subsequence containing the initial elements until predicate
returns false
and skipping the remaining elements.
func randomElement() -> Self.Element?
Returns a random element of the collection.
func randomElement<T>(using: inout T) -> Self.Element?
Returns a random element of the collection, using the given generator as a source for randomness.
func removingSubranges(RangeSet<Self.Index>) -> DiscontiguousSlice<Self>
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]
Returns the longest possible subsequences of the collection, in order, that don’t contain elements satisfying the given predicate.
func suffix(Int) -> Self.SubSequence
Returns a subsequence, up to the given maximum length, containing the final elements of the collection.
func suffix(from: Self.Index) -> Self.SubSequence
Returns a subsequence from the specified position to the end of the collection.