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

popLast()

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

Declaration 宣言

mutating func popLast() -> Element?

Return Value 戻り値

The last element of the collection if the collection is not empty; otherwise, nil. コレクションが空でないならばコレクションの最後の要素;そうでなければnil

Discussion 解説

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 要素の削除