JoinedIterator

struct JoinedIterator<Base : IteratorProtocol where Base.Element : Sequence>

An iterator that presents the elements of the sequences traversed by a base iterator, concatenated using a given separator.

Inheritance IteratorProtocol View Protocol Hierarchy →
Import import Swift

Initializers

init(base:separator:)

Creates an iterator that presents the elements of the sequences traversed by base, concatenated using separator.

Complexity: O(separator.count).

Declaration

init<Separator : Sequence where Separator.Iterator.Element == Base.Element.Iterator.Element>(base: Base, separator: Separator)

Instance Methods

mutating func next()

Advances to the next element and returns it, or nil if no next element exists.

Once nil has been returned, all subsequent calls return nil.

Declaration

mutating func next() -> Base.Element.Iterator.Element?