---
title: LazyPrefixWhileCollection
framework: swift
role: symbol
role_heading: Type Alias
path: swift/lazyprefixwhilecollection
---

# LazyPrefixWhileCollection

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

## Declaration

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

## Discussion

Discussion note: The performance of accessing endIndex depends on how many elements satisfy the predicate at the start of the collection, and might not offer the usual performance given by the Collection protocol. Accessing endIndex, the last property, or calling methods that depend on moving indices might not have the documented complexity.

## See Also

### Lazy Wrappers

- [LazySequence](swift/lazysequence.md)
- [LazyMapSequence](swift/lazymapsequence.md)
- [LazyFilterSequence](swift/lazyfiltersequence.md)
- [LazyPrefixWhileSequence](swift/lazyprefixwhilesequence.md)
- [LazyDropWhileSequence](swift/lazydropwhilesequence.md)
- [LazyCollection](swift/lazycollection.md)
- [LazyDropWhileCollection](swift/lazydropwhilecollection.md)
- [LazyFilterCollection](swift/lazyfiltercollection.md)
- [LazyMapCollection](swift/lazymapcollection.md)
