Generic Structure
ReversedCollection
A collection that presents the elements of its base collection in reverse order.
Overview
The reversed()
method is always lazy when applied to a collection with bidirectional indices, but does not implicitly confer laziness on algorithms applied to its result. In other words, for ordinary collections c
having bidirectional indices:
c.reversed()
does not create new storage
c.reversed().map(f)
maps eagerly and returns a new array
c.lazy.reversed().map(f)
maps lazily and returns a LazyMapCollection
Topics
Instance Methods
func joined(separator: String) -> String
Returns a new string by concatenating the elements of the sequence, adding the given separator between each element.
Available when Element conforms to StringProtocol.
See Also
Wrappers for Algorithms
struct DropFirstSequence
A sequence that lazily consumes and drops n
elements from an underlying Base
iterator before possibly returning the first available element.
struct DropWhileSequence
A sequence that lazily consumes and drops n
elements from an underlying Base
iterator before possibly returning the first available element.
struct FlattenSequence
A sequence consisting of all the elements contained in each segment contained in some Base
sequence.
struct JoinedSequence
A sequence that presents the elements of a base sequence of sequences concatenated using a given separator.
struct StrideTo
A sequence of values formed by striding over a half-open interval.
struct UnfoldSequence
A sequence whose elements are produced via repeated applications of a closure to some mutable state.