BidirectionalCollection (ext)
You’re viewing third-party extensions to BidirectionalCollection
, a protocol from the Swift standard library.
You can also read the documentation forBidirectionalCollection
itself.
extension BidirectionalCollection
You’re viewing third-party extensions to BidirectionalCollection
, a protocol from the Swift standard library.
You can also read the documentation forBidirectionalCollection
itself.
extension BidirectionalCollection
protocol BidirectionalCollection<Element> : Collection where Self.Indices : BidirectionalCollection, Self.SubSequence : BidirectionalCollection
A collection that supports backward as well as forward traversal.
import Algorithms
Swift Algorithms is an open-source package of sequence and collection algorithms, along with their related types.
func startOfSuffix(while predicate: (Element) throws -> Bool) rethrows -> Index
Returns the inclusive lower bound of the suffix of elements that satisfy the predicate.
func suffix(while predicate: (Element) throws -> Bool) rethrows -> SubSequence
Returns a subsequence containing the elements from the end until predicate
returns false
and skipping the remaining elements.
func trimming(while predicate: (Element) throws -> Bool) rethrows -> SubSequence
Returns a SubSequence
formed by discarding all elements at the start and end of the collection which satisfy the given predicate.
func trimmingSuffix(while predicate: (Element) throws -> Bool) rethrows -> SubSequence
Returns a SubSequence
formed by discarding all elements at the end of the collection which satisfy the given predicate.
protocol RangeReplaceableCollection<Element> : Collection where Self.SubSequence : RangeReplaceableCollection
A collection that supports replacement of an arbitrary subrange of elements with the elements of another collection.
mutating func trim(while predicate: (Element) throws -> Bool) rethrows
Mutates a BidirectionalCollection
by discarding all elements at the start and at the end of it which satisfy the given predicate.
mutating func trimSuffix(while predicate: (Element) throws -> Bool) rethrows
Mutates a BidirectionalCollection
by discarding all elements at the end of it which satisfy the given predicate.
mutating func trim(while predicate: (Element) throws -> Bool) rethrows
Mutates a BidirectionalCollection
by discarding all elements at the start and at the end of it which satisfy the given predicate.
mutating func trimSuffix(while predicate: (Element) throws -> Bool) rethrows
Mutates a BidirectionalCollection
by discarding all elements at the end of it which satisfy the given predicate.