Instance Method

drop(while:)

Returns a subsequence by skipping elements while predicate returns true and returning the remaining elements.

Required. Default implementations provided.

Declaration

func drop(while predicate: (Self.Element) throws -> Bool) rethrows -> Self.SubSequence

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.

Discussion

Complexity: O(n), where n is the length of the sequence.

Default Implementations

Collection Implementations

func drop(while: (Self.Element) -> Bool) -> Self.SubSequence

Returns a subsequence by skipping elements while predicate returns true and returning the remaining elements.

LazySequenceProtocol Implementations

func drop(while: (Self.Elements.Element) -> Bool) -> LazyDropWhileSequence<Self.Elements>

Returns a lazy sequence that skips any initial elements that satisfy predicate.

Sequence Implementations

func drop(while: (Self.Element) -> Bool) -> AnySequence<Self.Element>

Returns a subsequence by skipping the initial, consecutive elements that satisfy the given predicate.