Skip to main content

LazyCachedMapCollection

Read-only collection that applies transformation to element on first access.

public struct LazyCachedMapCollection<Element>: RandomAccessCollection 

Compared to LazyMapCollection does not evaluate the whole collection on count call.

Inheritance

Equatable, ExpressibleByArrayLiteral, RandomAccessCollection

Nested Type Aliases

Index

public typealias Index = Int

ArrayLiteralElement

public typealias ArrayLiteralElement = Element

Initializers

init(source:map:)

public init<Collection: RandomAccessCollection, SourceElement>(
source: Collection,
map: @escaping (SourceElement) -> Element
) where Collection.Element == SourceElement, Collection.Index == Index

init(arrayLiteral:)

public init(arrayLiteral elements: Element...) 

Properties

startIndex

public var startIndex: Index 

endIndex

public var endIndex: Index 

count

public var count: Index 

Methods

index(before:)

public func index(before i: Index) -> Index 

index(after:)

public func index(after i: Index) -> Index 

Did you find this page helpful?