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

removeLast(_:)

Removes the given number of elements from the end of the collection. 与えられた数の要素をコレクションの終わりから削除します。

Declaration 宣言

mutating func removeLast(_ k: Int)
Available when Base conforms to BidirectionalCollection. BaseBidirectionalCollectionに準拠する時に利用可能です。

Parameters パラメータ

k

The number of elements to remove. k must be greater than or equal to zero, and must be less than or equal to the number of elements in the collection. 削除する要素の数を返します。kは、ゼロより大きいか等しくなければなりません、そしてコレクションの要素数より少ないか等しくなければなりません。

Discussion 解説

Complexity: O(1) if the collection conforms to RandomAccessCollection; otherwise, O(k), where k is the number of elements to remove. 計算量:O(1)、もしコレクションがRandomAccessCollectionに準拠するならば;そうでなければ、O(k)、そこでkは除去される要素の数です。