Sequence
extension Sequence
-
Returns the descriptions of all elements, joined by the given
separator.Declaration
Swift
public func descriptions(joinedBy separator: String = ", ") -> String -
The result of the first scucessful transformation applied to elements in
self.Declaration
Swift
public func first<T>(transformedBy transform: (Element) throws -> T?) rethrows -> T? -
Returns the number of elements for which
predicateholds.Complexity
O(n) where n is the length ofself.Declaration
Swift
public func elementCount(where predicate: (Element) throws -> Bool) rethrows -> IntReturn Value
self.filter(predicate).count -
Returns the elements of the sequence, sorted by their values at
path.Complexity
O(n log n), where n is the length ofself.Declaration
Swift
public func sorted<T>(by path: KeyPath<Element, T>) -> [Element] where T : Comparable
View on GitHub