11
11
12
12
/// A collection wrapper that breaks a collection into chunks based on a
13
13
/// predicate or projection.
14
- public struct LazyChunked < Base: Collection , Subject> {
14
+ public struct Chunked < Base: Collection , Subject> {
15
15
/// The collection that this instance provides a view onto.
16
16
@usableFromInline
17
17
internal let base : Base
@@ -45,7 +45,7 @@ public struct LazyChunked<Base: Collection, Subject> {
45
45
}
46
46
}
47
47
48
- extension LazyChunked : LazyCollectionProtocol {
48
+ extension Chunked : LazyCollectionProtocol {
49
49
/// A position in a chunked collection.
50
50
public struct Index : Comparable {
51
51
/// The range corresponding to the chunk at this position.
@@ -106,9 +106,9 @@ extension LazyChunked: LazyCollectionProtocol {
106
106
}
107
107
}
108
108
109
- extension LazyChunked . Index : Hashable where Base. Index: Hashable { }
109
+ extension Chunked . Index : Hashable where Base. Index: Hashable { }
110
110
111
- extension LazyChunked : BidirectionalCollection
111
+ extension Chunked : BidirectionalCollection
112
112
where Base: BidirectionalCollection
113
113
{
114
114
/// Returns the index in the base collection of the start of the chunk ending
@@ -131,6 +131,9 @@ extension LazyChunked: BidirectionalCollection
131
131
}
132
132
}
133
133
134
+ @available ( * , deprecated, renamed: " Chunked " )
135
+ public typealias LazyChunked < Base: Collection , Subject> = Chunked < Base , Subject >
136
+
134
137
//===----------------------------------------------------------------------===//
135
138
// lazy.chunked(by:)
136
139
//===----------------------------------------------------------------------===//
@@ -143,8 +146,8 @@ extension LazyCollectionProtocol {
143
146
@inlinable
144
147
public func chunked(
145
148
by belongInSameGroup: @escaping ( Element , Element ) -> Bool
146
- ) -> LazyChunked < Elements , Element > {
147
- LazyChunked (
149
+ ) -> Chunked < Elements , Element > {
150
+ Chunked (
148
151
base: elements,
149
152
projection: { $0 } ,
150
153
belongInSameGroup: belongInSameGroup)
@@ -157,8 +160,8 @@ extension LazyCollectionProtocol {
157
160
@inlinable
158
161
public func chunked< Subject: Equatable > (
159
162
on projection: @escaping ( Element ) -> Subject
160
- ) -> LazyChunked < Elements , Subject > {
161
- LazyChunked (
163
+ ) -> Chunked < Elements , Subject > {
164
+ Chunked (
162
165
base: elements,
163
166
projection: projection,
164
167
belongInSameGroup: == )
0 commit comments