Skip to content

[stdlib] Improved documentation for popLast() & removeLast() in BidirectionalCollection #5333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions stdlib/public/core/BidirectionalCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ extension BidirectionalCollection where SubSequence == BidirectionalSlice<Self>

extension BidirectionalCollection where SubSequence == Self {
/// Removes and returns the last element of the collection.
///
/// Use `popLast()` to remove the last element of a collection that might be empty.
///
/// The `removeLast()` method must be used only on a nonempty collection.
///
/// - Returns: The last element of the collection if the collection has one
/// or more elements; otherwise, `nil`.
Expand All @@ -221,6 +225,9 @@ extension BidirectionalCollection where SubSequence == Self {
///
/// The collection must not be empty.
///
/// To remove the last element of a collection that might be empty,
/// use the `popLast()` method instead.
///
/// - Returns: The last element of the collection.
///
/// - Complexity: O(1)
Expand Down