RangeReplaceableCollection

protocol RangeReplaceableCollection : Collection
  • Mechanica

    Removes the first element that matches the given predicate.

    Declaration

    Swift

    public mutating func removeFirst(where predicate: (Iterator.Element) -> Bool) -> Iterator.Element?

    Parameters

    predicate

    A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element is a match.

  • Mechanica

    Removes the first element that matches the given predicate and returns a new collection.

    Declaration

    Swift

    public final func removingFirst(where predicate: (Iterator.Element) -> Bool) -> Self

    Parameters

    predicate

    A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element is a match.

  • Mechanica

    Removes the last element that matches the given predicate.

    Declaration

    Swift

    public mutating func removeLast(where predicate: (Iterator.Element) -> Bool) -> Iterator.Element?

    Parameters

    predicate

    A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element is a match.

  • Mechanica

    Removes the last element that matches the given predicate and returns a new collection.

    Declaration

    Swift

    public final func removingLast(where predicate: (Iterator.Element) -> Bool) -> Self

    Parameters

    predicate

    A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element is a match.

  • Mechanica

    Removes all the elements that matches the given predicate and returns all the removed element (if any).

    Declaration

    Swift

    public mutating func removeAll(where predicate: (Iterator.Element) -> Bool) -> [Iterator.Element]

    Parameters

    predicate

    A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element is a match.

  • Mechanica

    Removes all the elements that matches the given predicate and returns a new array.

    Declaration

    Swift

    public final func removingAll(where predicate: (Iterator.Element) -> Bool) -> Self

    Parameters

    predicate

    A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element is a match.

  • Mechanica Removes the first specified element from the collection (if exists).

    Declaration

    Swift

    public mutating func removeFirstOccurrence(of element: Iterator.Element) -> Iterator.Element?

    Parameters

    element

    The element to remove the last occurrence.

    Return Value

    The element removed (if any).

  • Mechanica

    Removes the last specified element from the array (if exists).

    Declaration

    Swift

    public mutating func removeLastOccurrence(of element: Iterator.Element) -> Iterator.Element?

    Parameters

    element

    The element to remove the collection occurrence.

    Return Value

    The element removed (if any).