Instance Method

# popFirst()

Removes and returns the first element of the collection.

## Return Value

The first element of the collection if the collection is not empty; otherwise, `nil`.

## Discussion

Complexity: O(1)

### Selecting Nodes

`func append(IndexPath)`

Appends the nodes of another index path to this one.

`func append(Array<IndexPath.Element>)`

Appends an array of elements to this index path as additional nodes.

`func append(IndexPath.Element)`

Appends a single element to this index path as a new node.

`func appending(IndexPath.Element) -> IndexPath`

Returns a new index path containing the elements of this one plus the given element.

`func appending(IndexPath) -> IndexPath`

Returns a new index path containing the elements of this one plus those of another index path.

`func appending(Array<IndexPath.Element>) -> IndexPath`

Returns a new index path containing the elements of this one plus an array of additional elements.

`func compare(IndexPath) -> ComparisonResult`

Compares this index path to another in depth-first traversal order.

`func dropFirst(Int) -> IndexPath`

Returns a subsequence containing all but the given number of initial elements.

`func dropLast() -> IndexPath`

Return a new index path containing all but the last element.

`func dropLast(Int) -> IndexPath`

Returns a subsequence containing all but the specified number of final elements.

`func elementsEqual<OtherSequence>(OtherSequence) -> Bool`

Returns a Boolean value indicating whether this sequence and another sequence contain the same elements in the same order.

`func enumerated() -> EnumeratedSequence<IndexPath>`

Returns a sequence of pairs (n, x), where n represents a consecutive integer starting at zero and x represents an element of the sequence.

`func index(after: IndexPath.Index) -> IndexPath.Index`

Returns the index that follows the given index.

`func index(before: IndexPath.Index) -> IndexPath.Index`

Returns the index that precedes the given index.

`func lexicographicallyPrecedes<OtherSequence>(OtherSequence) -> Bool`

Returns a Boolean value indicating whether the sequence precedes another sequence in a lexicographical (dictionary) ordering, using the less-than operator (`<`) to compare elements.

`func makeIterator() -> IndexingIterator<IndexPath>`

Returns an iterator over the nodes of the index path.

`func max() -> Int?`

Returns the maximum element in the sequence.

`func min() -> Int?`

Returns the minimum element in the sequence.

`func popLast() -> Int?`

Removes and returns the last element of the collection.

`func prefix(Int) -> IndexPath`

Returns a subsequence, up to the specified maximum length, containing the initial elements of the collection.

`func prefix(through: Array<Int>.Index) -> IndexPath`

Returns a subsequence from the start of the collection through the specified position.

`func prefix(upTo: Array<Int>.Index) -> IndexPath`

Returns a subsequence from the start of the collection up to, but not including, the specified position.

`func removeFirst() -> Int`

Removes and returns the first element of the collection.

`func removeFirst(Int)`

Removes the specified number of elements from the beginning of the collection.

`func removeLast() -> Int`

Removes and returns the last element of the collection.

`func removeLast(Int)`

Removes the given number of elements from the end of the collection.

`func reversed() -> ReversedCollection<IndexPath>`

Returns a view presenting the elements of the collection in reverse order.

`func sorted() -> [Int]`

Returns the elements of the sequence, sorted.

`func starts<PossiblePrefix>(with: PossiblePrefix) -> Bool`

Returns a Boolean value indicating whether the initial elements of the sequence are the same as the elements in another sequence.

`func suffix(Int) -> IndexPath`

Returns a subsequence, up to the given maximum length, containing the final elements of the collection.

`func suffix(from: Array<Int>.Index) -> IndexPath`

Returns a subsequence from the specified position to the end of the collection.