We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1954ca6 + e7bd9a2 commit dff2675Copy full SHA for dff2675
library/src/scala/collection/Iterator.scala
@@ -1257,12 +1257,15 @@ object Iterator extends IterableFactory[Iterator] {
1257
else if (until <= lo) 0 // empty
1258
else if (unbounded) until - lo // now finite
1259
else adjustedBound min (until - lo) // keep lesser bound
1260
+ val sum = dropping + lo
1261
if (rest == 0) empty
1262
+ else if (sum < 0) {
1263
+ dropping = Int.MaxValue
1264
+ remaining = 0
1265
+ this.concat(new SliceIterator(underlying, start = sum - Int.MaxValue, limit = rest))
1266
+ }
1267
else {
- dropping = {
- val sum = dropping + lo
- if (sum < 0) Int.MaxValue else sum
- }
1268
+ dropping = sum
1269
remaining = rest
1270
this
1271
}
0 commit comments