Skip to content

Commit

Permalink
Merge pull request #314 from barakugav/arraylist-iterator-back
Browse files Browse the repository at this point in the history
ArrayList iterator back() bug fix, compute remaining correctly
  • Loading branch information
vigna authored Feb 6, 2024
2 parents 134cee3 + 54da286 commit 8b5ccdf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drv/ArrayList.drv
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ public class ARRAY_LIST KEY_GENERIC extends ABSTRACT_LIST KEY_GENERIC implements
@Override
public int back(int n) {
if (n < 0) throw new IllegalArgumentException("Argument must be nonnegative: " + n);
final int remaining = size - pos;
final int remaining = pos;
if (n < remaining) {
pos -= n;
} else {
Expand Down

0 comments on commit 8b5ccdf

Please sign in to comment.