Skip to content

Commit 416a7fb

Browse files
committed
调整代码顺序
1 parent 687c46a commit 416a7fb

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

src/main/java/com/bestvike/linq/enumerable/SelectMany.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,6 @@ public void close() {
121121
super.close();
122122
}
123123

124-
@Override
125-
public int _getCount(boolean onlyIfCheap) {
126-
if (onlyIfCheap)
127-
return -1;
128-
129-
int count = 0;
130-
for (TSource element : this.source)
131-
count = Math.addExact(count, this.selector.apply(element).count());
132-
133-
return count;
134-
}
135-
136124
@Override
137125
public TResult[] _toArray(Class<TResult> clazz) {
138126
SparseArrayBuilder<TResult> builder = new SparseArrayBuilder<>();
@@ -183,6 +171,18 @@ public List<TResult> _toList() {
183171

184172
return list;
185173
}
174+
175+
@Override
176+
public int _getCount(boolean onlyIfCheap) {
177+
if (onlyIfCheap)
178+
return -1;
179+
180+
int count = 0;
181+
for (TSource element : this.source)
182+
count = Math.addExact(count, this.selector.apply(element).count());
183+
184+
return count;
185+
}
186186
}
187187

188188

@@ -251,21 +251,6 @@ public void close() {
251251
super.close();
252252
}
253253

254-
@Override
255-
public int _getCount(boolean onlyIfCheap) {
256-
if (onlyIfCheap)
257-
return -1;
258-
259-
int count = 0;
260-
int index = 0;
261-
for (TSource element : this.source) {
262-
count = Math.addExact(count, this.selector.apply(element, index).count());
263-
index = Math.addExact(index, 1);
264-
}
265-
266-
return count;
267-
}
268-
269254
@Override
270255
public TResult[] _toArray(Class<TResult> clazz) {
271256
SparseArrayBuilder<TResult> builder = new SparseArrayBuilder<>();
@@ -323,6 +308,21 @@ public List<TResult> _toList() {
323308

324309
return list;
325310
}
311+
312+
@Override
313+
public int _getCount(boolean onlyIfCheap) {
314+
if (onlyIfCheap)
315+
return -1;
316+
317+
int count = 0;
318+
int index = 0;
319+
for (TSource element : this.source) {
320+
count = Math.addExact(count, this.selector.apply(element, index).count());
321+
index = Math.addExact(index, 1);
322+
}
323+
324+
return count;
325+
}
326326
}
327327

328328

0 commit comments

Comments
 (0)