Generic Instance Method

flatMap(_:)

Returns the non-nil results of mapping the given transformation over this sequence.

Declaration

func flatMap<ElementOfResult>(_ transform: @escaping (Base.Element) -> ElementOfResult?) -> LazyMapSequence<LazyFilterSequence<LazyMapSequence<LazyPrefixWhileSequence<Base>, ElementOfResult?>>, ElementOfResult>

Parameters

transform

A closure that accepts an element of this sequence as its argument and returns an optional value.

Discussion

Use this method to receive a sequence of non-optional values when your transformation produces an optional value.

Complexity: O(1)