Generic Type Alias

LazyPrefixWhileCollection

A lazy collection wrapper that includes the initial consecutive elements of an underlying collection that satisfy a predicate.

Declaration

typealias LazyPrefixWhileCollection<T> = LazyPrefixWhileSequence<T> where T : Collection

Discussion

Topics

Instance Properties

var endIndex: LazyPrefixWhileSequence<Base>.Index

The collection’s “past the end” position—that is, the position one greater than the last valid subscript argument.

var lazy: LazyCollection<LazyPrefixWhileSequence<Base>>

A sequence containing the same elements as this sequence, but on which some operations, such as map and filter, are implemented lazily.

var startIndex: LazyPrefixWhileSequence<Base>.Index

The position of the first element in a nonempty collection.

Instance Methods

func dropFirst(Int) -> Slice<LazyPrefixWhileCollection<Base>>

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

func dropLast(Int) -> Slice<LazyPrefixWhileCollection<Base>>

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

func firstIndex(where: (Base.Element) -> Bool) -> Index?

Returns the first index in which an element of the collection satisfies the given predicate.

func index(after: LazyPrefixWhileSequence<Base>.Index) -> LazyPrefixWhileSequence<Base>.Index

Returns the position immediately after the given index.

func index(before: LazyPrefixWhileSequence<Base>.Index) -> LazyPrefixWhileSequence<Base>.Index

Returns the position immediately before the given index.

func map<T>((Base.Element) -> T) -> [T]

Returns an array containing the results of mapping the given closure over the sequence’s elements.

func prefix(Int) -> Slice<LazyPrefixWhileCollection<Base>>

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

func prefix(through: Index) -> Slice<LazyPrefixWhileCollection<Base>>

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

func prefix(upTo: Index) -> Slice<LazyPrefixWhileCollection<Base>>

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

func split(maxSplits: Int, omittingEmptySubsequences: Bool, whereSeparator: (Base.Element) -> Bool) -> [Slice<LazyPrefixWhileCollection<Base>>]

Returns the longest possible subsequences of the collection, in order, that don’t contain elements satisfying the given predicate.

func suffix(Int) -> Slice<LazyPrefixWhileCollection<Base>>

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

func suffix(from: Index) -> Slice<LazyPrefixWhileCollection<Base>>

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

Subscripts

subscript<R>(R) -> Slice<LazyPrefixWhileCollection<Base>>

Accesses the contiguous subrange of the collection’s elements specified by a range expression.

subscript(LazyPrefixWhileSequence<Base>.Index) -> LazyPrefixWhileSequence<Base>.Element

Accesses the element at the specified position.

See Also

Lazy Wrappers

struct LazySequence

A sequence containing the same elements as a Base sequence, but on which some operations such as map and filter are implemented lazily.

struct LazyMapSequence

A Sequence whose elements consist of those in a Base Sequence passed through a transform function returning Element. These elements are computed lazily, each time they’re read, by calling the transform function on a base element.

struct LazyFilterSequence

A sequence whose elements consist of the elements of some base sequence that also satisfy a given predicate.

struct LazyPrefixWhileSequence

A sequence whose elements consist of the initial consecutive elements of some base sequence that satisfy a given predicate.

struct LazyDropWhileSequence

A sequence whose elements consist of the elements that follow the initial consecutive elements of some base sequence that satisfy a given predicate.

typealias LazyCollection

A collection containing the same elements as a Base collection, but on which some operations such as map and filter are implemented lazily.

typealias LazyDropWhileCollection

A lazy wrapper that includes the elements of an underlying collection after any initial consecutive elements that satisfy a predicate.

typealias LazyFilterCollection

A lazy Collection wrapper that includes the elements of an underlying collection that satisfy a predicate.

typealias LazyMapCollection

A Collection whose elements consist of those in a Base Collection passed through a transform function returning Element. These elements are computed lazily, each time they’re read, by calling the transform function on a base element.