Instance Method インスタンスメソッド

max()

Returns the maximum element in an asynchronous sequence of comparable elements. 比較可能要素それらからなるある非同期シーケンスの中の最大の要素を返します。

Declaration 宣言

@warn_unqualified_access func max() async rethrows -> UnicodeScalar?

Return Value 戻り値

The sequence’s maximum element. If the sequence has no elements, returns nil. シーケンスの最大の要素。シーケンスが要素を持たないならば、nilを返します。

Discussion 議論

In this example, an asynchronous sequence called Counter produces Int values from 1 to 10. The max() method returns the max value of the sequence. この例において、Counterと呼ばれる非同期シーケンスはInt値を1から10まで生み出します。max()メソッドは、シーケンスの最大値を返します。


let max = await Counter(howHigh: 10)
    .max()
print(max ?? "none")
// Prints: 10

See Also 参照

Finding Elements 要素を見つける