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

removeLast()

Removes and returns the last element of the collection. コレクションの最後の要素を削除して返します。

Declaration 宣言

@discardableResult mutating func removeLast() -> Element

Return Value 戻り値

The last element of the collection. コレクションの最後の要素。

Discussion 解説

The collection must not be empty. コレクションは空であってはなりません。

Calling this method may invalidate all saved indices of this collection. Do not rely on a previously stored index value after altering a collection with any operation that can change its length. このメソッドを呼び出すことは、このコレクションの全ての保存されたインデックスを無効にします。あるコレクションをそれの長さを変える何らかの演算で手直し後に、以前に格納されたインデックス値を当てにしないでください。

Complexity: O(1) 計算量:O(1)

See Also 参照

Removing Elements 要素の削除