@@ -126,16 +126,6 @@ public AbstractIterator<TSource> clone() {
126
126
return new WhereArrayIterator <>(this .source , this .predicate );
127
127
}
128
128
129
- @ Override
130
- public <TResult > IEnumerable <TResult > _select (Func1 <TSource , TResult > selector ) {
131
- return new WhereSelectArrayIterator <>(this .source , this .predicate , selector );
132
- }
133
-
134
- @ Override
135
- public IEnumerable <TSource > _where (Func1 <TSource , Boolean > predicate ) {
136
- return new WhereArrayIterator <>(this .source , Utilities .combinePredicates (this .predicate , predicate ));
137
- }
138
-
139
129
@ Override
140
130
public boolean moveNext () {
141
131
switch (this .state ) {
@@ -158,17 +148,13 @@ public boolean moveNext() {
158
148
}
159
149
160
150
@ Override
161
- public int _getCount (boolean onlyIfCheap ) {
162
- if (onlyIfCheap )
163
- return -1 ;
164
-
165
- int count = 0 ;
166
- for (TSource item : this .source ) {
167
- if (this .predicate .apply (item ))
168
- count = Math .addExact (count , 1 );
169
- }
151
+ public <TResult > IEnumerable <TResult > _select (Func1 <TSource , TResult > selector ) {
152
+ return new WhereSelectArrayIterator <>(this .source , this .predicate , selector );
153
+ }
170
154
171
- return count ;
155
+ @ Override
156
+ public IEnumerable <TSource > _where (Func1 <TSource , Boolean > predicate ) {
157
+ return new WhereArrayIterator <>(this .source , Utilities .combinePredicates (this .predicate , predicate ));
172
158
}
173
159
174
160
@ Override
@@ -203,6 +189,20 @@ public List<TSource> _toList() {
203
189
204
190
return list ;
205
191
}
192
+
193
+ @ Override
194
+ public int _getCount (boolean onlyIfCheap ) {
195
+ if (onlyIfCheap )
196
+ return -1 ;
197
+
198
+ int count = 0 ;
199
+ for (TSource item : this .source ) {
200
+ if (this .predicate .apply (item ))
201
+ count = Math .addExact (count , 1 );
202
+ }
203
+
204
+ return count ;
205
+ }
206
206
}
207
207
208
208
@@ -223,16 +223,6 @@ public Iterator<TSource> clone() {
223
223
return new WhereListIterator <>(this .source , this .predicate );
224
224
}
225
225
226
- @ Override
227
- public <TResult > IEnumerable <TResult > _select (Func1 <TSource , TResult > selector ) {
228
- return new WhereSelectListIterator <>(this .source , this .predicate , selector );
229
- }
230
-
231
- @ Override
232
- public IEnumerable <TSource > _where (Func1 <TSource , Boolean > predicate ) {
233
- return new WhereListIterator <>(this .source , Utilities .combinePredicates (this .predicate , predicate ));
234
- }
235
-
236
226
@ Override
237
227
public boolean moveNext () {
238
228
switch (this .state ) {
@@ -255,17 +245,22 @@ public boolean moveNext() {
255
245
}
256
246
257
247
@ Override
258
- public int _getCount (boolean onlyIfCheap ) {
259
- if (onlyIfCheap )
260
- return -1 ;
261
-
262
- int count = 0 ;
263
- for (TSource item : this .source ) {
264
- if (this .predicate .apply (item ))
265
- count = Math .addExact (count , 1 );
248
+ public void close () {
249
+ if (this .enumerator != null ) {
250
+ this .enumerator .close ();
251
+ this .enumerator = null ;
266
252
}
253
+ super .close ();
254
+ }
267
255
268
- return count ;
256
+ @ Override
257
+ public <TResult > IEnumerable <TResult > _select (Func1 <TSource , TResult > selector ) {
258
+ return new WhereSelectListIterator <>(this .source , this .predicate , selector );
259
+ }
260
+
261
+ @ Override
262
+ public IEnumerable <TSource > _where (Func1 <TSource , Boolean > predicate ) {
263
+ return new WhereListIterator <>(this .source , Utilities .combinePredicates (this .predicate , predicate ));
269
264
}
270
265
271
266
@ Override
@@ -302,12 +297,17 @@ public List<TSource> _toList() {
302
297
}
303
298
304
299
@ Override
305
- public void close () {
306
- if (this .enumerator != null ) {
307
- this .enumerator .close ();
308
- this .enumerator = null ;
300
+ public int _getCount (boolean onlyIfCheap ) {
301
+ if (onlyIfCheap )
302
+ return -1 ;
303
+
304
+ int count = 0 ;
305
+ for (TSource item : this .source ) {
306
+ if (this .predicate .apply (item ))
307
+ count = Math .addExact (count , 1 );
309
308
}
310
- super .close ();
309
+
310
+ return count ;
311
311
}
312
312
}
313
313
@@ -329,16 +329,6 @@ public AbstractIterator<TSource> clone() {
329
329
return new WhereEnumerableIterator <>(this .source , this .predicate );
330
330
}
331
331
332
- @ Override
333
- public <TResult > IEnumerable <TResult > _select (Func1 <TSource , TResult > selector ) {
334
- return new WhereSelectEnumerableIterator <>(this .source , this .predicate , selector );
335
- }
336
-
337
- @ Override
338
- public IEnumerable <TSource > _where (Func1 <TSource , Boolean > predicate ) {
339
- return new WhereEnumerableIterator <>(this .source , Utilities .combinePredicates (this .predicate , predicate ));
340
- }
341
-
342
332
@ Override
343
333
public boolean moveNext () {
344
334
switch (this .state ) {
@@ -361,17 +351,22 @@ public boolean moveNext() {
361
351
}
362
352
363
353
@ Override
364
- public int _getCount (boolean onlyIfCheap ) {
365
- if (onlyIfCheap )
366
- return -1 ;
367
-
368
- int count = 0 ;
369
- for (TSource item : this .source ) {
370
- if (this .predicate .apply (item ))
371
- count = Math .addExact (count , 1 );
354
+ public void close () {
355
+ if (this .enumerator != null ) {
356
+ this .enumerator .close ();
357
+ this .enumerator = null ;
372
358
}
359
+ super .close ();
360
+ }
373
361
374
- return count ;
362
+ @ Override
363
+ public <TResult > IEnumerable <TResult > _select (Func1 <TSource , TResult > selector ) {
364
+ return new WhereSelectEnumerableIterator <>(this .source , this .predicate , selector );
365
+ }
366
+
367
+ @ Override
368
+ public IEnumerable <TSource > _where (Func1 <TSource , Boolean > predicate ) {
369
+ return new WhereEnumerableIterator <>(this .source , Utilities .combinePredicates (this .predicate , predicate ));
375
370
}
376
371
377
372
@ Override
@@ -408,12 +403,17 @@ public List<TSource> _toList() {
408
403
}
409
404
410
405
@ Override
411
- public void close () {
412
- if (this .enumerator != null ) {
413
- this .enumerator .close ();
414
- this .enumerator = null ;
406
+ public int _getCount (boolean onlyIfCheap ) {
407
+ if (onlyIfCheap )
408
+ return -1 ;
409
+
410
+ int count = 0 ;
411
+ for (TSource item : this .source ) {
412
+ if (this .predicate .apply (item ))
413
+ count = Math .addExact (count , 1 );
415
414
}
416
- super .close ();
415
+
416
+ return count ;
417
417
}
418
418
}
419
419
@@ -438,24 +438,6 @@ public Iterator<TResult> clone() {
438
438
return new WhereSelectArrayIterator <>(this .source , this .predicate , this .selector );
439
439
}
440
440
441
- @ Override
442
- public int _getCount (boolean onlyIfCheap ) {
443
- // In case someone uses Count() to force evaluation of
444
- // the selector, run it provided `onlyIfCheap` is false.
445
- if (onlyIfCheap )
446
- return -1 ;
447
-
448
- int count = 0 ;
449
- for (TSource item : this .source ) {
450
- if (this .predicate .apply (item )) {
451
- this .selector .apply (item );
452
- count = Math .addExact (count , 1 );
453
- }
454
- }
455
-
456
- return count ;
457
- }
458
-
459
441
@ Override
460
442
public boolean moveNext () {
461
443
switch (this .state ) {
@@ -515,6 +497,24 @@ public List<TResult> _toList() {
515
497
516
498
return list ;
517
499
}
500
+
501
+ @ Override
502
+ public int _getCount (boolean onlyIfCheap ) {
503
+ // In case someone uses Count() to force evaluation of
504
+ // the selector, run it provided `onlyIfCheap` is false.
505
+ if (onlyIfCheap )
506
+ return -1 ;
507
+
508
+ int count = 0 ;
509
+ for (TSource item : this .source ) {
510
+ if (this .predicate .apply (item )) {
511
+ this .selector .apply (item );
512
+ count = Math .addExact (count , 1 );
513
+ }
514
+ }
515
+
516
+ return count ;
517
+ }
518
518
}
519
519
520
520
@@ -538,24 +538,6 @@ public Iterator<TResult> clone() {
538
538
return new WhereSelectListIterator <>(this .source , this .predicate , this .selector );
539
539
}
540
540
541
- @ Override
542
- public int _getCount (boolean onlyIfCheap ) {
543
- // In case someone uses Count() to force evaluation of
544
- // the selector, run it provided `onlyIfCheap` is false.
545
- if (onlyIfCheap )
546
- return -1 ;
547
-
548
- int count = 0 ;
549
- for (TSource item : this .source ) {
550
- if (this .predicate .apply (item )) {
551
- this .selector .apply (item );
552
- count = Math .addExact (count , 1 );
553
- }
554
- }
555
-
556
- return count ;
557
- }
558
-
559
541
@ Override
560
542
public boolean moveNext () {
561
543
switch (this .state ) {
@@ -577,6 +559,15 @@ public boolean moveNext() {
577
559
}
578
560
}
579
561
562
+ @ Override
563
+ public void close () {
564
+ if (this .enumerator != null ) {
565
+ this .enumerator .close ();
566
+ this .enumerator = null ;
567
+ }
568
+ super .close ();
569
+ }
570
+
580
571
@ Override
581
572
public <TResult2 > IEnumerable <TResult2 > _select (Func1 <TResult , TResult2 > selector ) {
582
573
return new WhereSelectListIterator <>(this .source , this .predicate , Utilities .combineSelectors (this .selector , selector ));
@@ -616,12 +607,21 @@ public List<TResult> _toList() {
616
607
}
617
608
618
609
@ Override
619
- public void close () {
620
- if (this .enumerator != null ) {
621
- this .enumerator .close ();
622
- this .enumerator = null ;
610
+ public int _getCount (boolean onlyIfCheap ) {
611
+ // In case someone uses Count() to force evaluation of
612
+ // the selector, run it provided `onlyIfCheap` is false.
613
+ if (onlyIfCheap )
614
+ return -1 ;
615
+
616
+ int count = 0 ;
617
+ for (TSource item : this .source ) {
618
+ if (this .predicate .apply (item )) {
619
+ this .selector .apply (item );
620
+ count = Math .addExact (count , 1 );
621
+ }
623
622
}
624
- super .close ();
623
+
624
+ return count ;
625
625
}
626
626
}
627
627
@@ -646,24 +646,6 @@ public Iterator<TResult> clone() {
646
646
return new WhereSelectEnumerableIterator <>(this .source , this .predicate , this .selector );
647
647
}
648
648
649
- @ Override
650
- public int _getCount (boolean onlyIfCheap ) {
651
- // In case someone uses Count() to force evaluation of
652
- // the selector, run it provided `onlyIfCheap` is false.
653
- if (onlyIfCheap )
654
- return -1 ;
655
-
656
- int count = 0 ;
657
- for (TSource item : this .source ) {
658
- if (this .predicate .apply (item )) {
659
- this .selector .apply (item );
660
- count = Math .addExact (count , 1 );
661
- }
662
- }
663
-
664
- return count ;
665
- }
666
-
667
649
@ Override
668
650
public boolean moveNext () {
669
651
switch (this .state ) {
@@ -685,6 +667,15 @@ public boolean moveNext() {
685
667
}
686
668
}
687
669
670
+ @ Override
671
+ public void close () {
672
+ if (this .enumerator != null ) {
673
+ this .enumerator .close ();
674
+ this .enumerator = null ;
675
+ }
676
+ super .close ();
677
+ }
678
+
688
679
@ Override
689
680
public <TResult2 > IEnumerable <TResult2 > _select (Func1 <TResult , TResult2 > selector ) {
690
681
return new WhereSelectEnumerableIterator <>(this .source , this .predicate , Utilities .combineSelectors (this .selector , selector ));
@@ -724,11 +715,20 @@ public List<TResult> _toList() {
724
715
}
725
716
726
717
@ Override
727
- public void close () {
728
- if (this .enumerator != null ) {
729
- this .enumerator .close ();
730
- this .enumerator = null ;
718
+ public int _getCount (boolean onlyIfCheap ) {
719
+ // In case someone uses Count() to force evaluation of
720
+ // the selector, run it provided `onlyIfCheap` is false.
721
+ if (onlyIfCheap )
722
+ return -1 ;
723
+
724
+ int count = 0 ;
725
+ for (TSource item : this .source ) {
726
+ if (this .predicate .apply (item )) {
727
+ this .selector .apply (item );
728
+ count = Math .addExact (count , 1 );
729
+ }
731
730
}
732
- super .close ();
731
+
732
+ return count ;
733
733
}
734
734
}
0 commit comments