Instance Method
インスタンスメソッド
removeFirst()
Removes and returns the first element of the collection.
コレクションの最初の要素を削除して返します。
Required. Default implementations provided.
必須。 いくつかの省略時の実装の提供。
Technology
- Swift Standard Library
Swift標準ライブラリ
Declaration
宣言
@discardableResult mutating func removeFirst() -> Self.Element
Return Value
戻り値
The removed element.
削除された要素。
Discussion
解説
The collection must not be empty.
コレクションは空であってはなりません。
var bugs = ["Aphid", "Bumblebee", "Cicada", "Damselfly", "Earwig"]
bugs.removeFirst()
print(bugs)
Calling this method may invalidate any existing indices for use with this collection.
このメソッドを呼び出すことは、このコレクションで使うためのあらゆる既存のインデックスを無効にします。
Complexity: O(n), where n is the length of the collection.
計算量:O(n)、ここでnはコレクションの長さです。
Default Implementations
省略時実装
RangeReplaceableCollection Implementations
func removeFirst() -> Self.Element
Removes and returns the first element of the collection.
コレクションの最初の要素を削除して返します。
Available when Self
is
SubSequence
.
Self
が
SubSequence
である時に利用可能です。