Instance Methodswift 6.0.1Swift
map(_:)
Returns a LazyMapSequence
over this Sequence
. The elements of the result are computed lazily, each time they are read, by calling transform
function on a base element.
func map<U>(_ transform: @escaping (Self.Element) -> U) -> LazyMapSequence<Self.Elements, U>
Other members in extension
Instance members
var lazy: LazySequence<Self.Elements>
func compactMap<ElementOfResult>(@escaping (Self.Elements.Element) -> ElementOfResult?
) -> LazyMapSequence<LazyFilterSequence<LazyMapSequence<Self.Elements, ElementOfResult?>>, ElementOfResult> Returns the non-
nil
results of mapping the given transformation over this sequence.func drop(while: @escaping (Self.Elements.Element) -> Bool
) -> LazyDropWhileSequence<Self.Elements> Returns a lazy sequence that skips any initial elements that satisfy
predicate
.func filter(@escaping (Self.Elements.Element) -> Bool
) -> LazyFilterSequence<Self.Elements> Returns the elements of
self
that satisfyisIncluded
.func flatMap<SegmentOfResult>(@escaping (Self.Elements.Element) -> SegmentOfResult
) -> LazySequence<FlattenSequence<LazyMapSequence<Self.Elements, SegmentOfResult>>> Returns the concatenated results of mapping the given transformation over this sequence.
func prefix(while: @escaping (Self.Elements.Element) -> Bool
) -> LazyPrefixWhileSequence<Self.Elements> Returns a lazy sequence of the initial consecutive elements that satisfy
predicate
.
Show obsolete interfaces (1)
Hide obsolete interfaces
func flatMap<ElementOfResult>(@escaping (Self.Elements.Element) -> ElementOfResult?
) -> LazyMapSequence<LazyFilterSequence<LazyMapSequence<Self.Elements, ElementOfResult?>>, ElementOfResult> Returns the non-
nil
results of mapping the given transformation over this sequence.