Generic Instance Method 総称体インスタンスメソッド

flatMap(_:)

Returns the non-nil results of mapping the given transformation over this sequence. 与えられた変換をこのシーケンス全体にわたってマッピングする非nilの結果を返します。

Declaration 宣言

func flatMap<ElementOfResult>(_ transform: @escaping (Base.Element) -> ElementOfResult?) -> LazyMapSequence<LazyFilterSequence<LazyMapSequence<ReversedCollection<Base>, ElementOfResult?>>, ElementOfResult>
Available when Base conforms to LazySequenceProtocol. BaseLazySequenceProtocolに準拠する場合に利用可能です。

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) 計算量:O(1)