LazyForwardCollection

struct LazyForwardCollection<S : CollectionType where S.Index : ForwardIndexType>

A collection that forwards its implementation to an underlying collection instance while exposing lazy computations as methods.

Inheritance CollectionType, SequenceType, _CollectionType, _SequenceType, _Sequence_Type View Protocol Hierarchy →
Associated Types
Generator = S.Generator

Type alias inferred.

Element = S.Generator.Element

Type alias inferred.

Index = S.Index

Type alias inferred.

SubSequence = Slice<LazyForwardCollection<S>>

Type alias inferred.

Import import Swift

Initializers

init(_:)

Construct an instance with base as its underlying collection instance.

Declaration

init(_ base: S)

Instance Variables

var array: [S.Generator.Element]

an Array, created on-demand, containing the elements of this lazy CollectionType.

Declaration

var array: [S.Generator.Element] { get }
var endIndex: S.Index

The collection's "past the end" position.

endIndex is not a valid argument to subscript, and is always reachable from startIndex by zero or more applications of successor().

Declaration

var endIndex: S.Index { get }
var first: S.Generator.Element?

The first element, or nil if self is empty

Declaration

var first: S.Generator.Element? { get }
var isEmpty: Bool

True if and only if the collection is empty

Declaration

var isEmpty: Bool { get }
var startIndex: S.Index

The position of the first element in a non-empty collection.

Identical to endIndex in an empty collection.

Declaration

var startIndex: S.Index { get }

Subscripts

subscript(_: S.Index)

Declaration

subscript(position: S.Index) -> S.Generator.Element { get }

Instance Methods

func filter(_:)

Return a lazy SequenceType containing the elements x of source for which includeElement(x) is true

Declaration

func filter(includeElement: (S.Generator.Element) -> Bool) -> LazySequence<FilterSequenceView<S>>
func generate()

Return a generator over the elements of this sequence.

Complexity: O(1)

Declaration

func generate() -> S.Generator
func map(_:)

Return a MapCollectionView over this LazyForwardCollection. The elements of the result are computed lazily, each time they are read, by calling transform function on a base element.

Declaration

func map<U>(transform: (S.Generator.Element) -> U) -> LazyForwardCollection<MapCollectionView<S, U>>