Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in ImmutableSubList.ListIterator#hasNext #307

Open
meztihn opened this issue Oct 19, 2023 · 2 comments
Open

Error in ImmutableSubList.ListIterator#hasNext #307

meztihn opened this issue Oct 19, 2023 · 2 comments

Comments

@meztihn
Copy link

meztihn commented Oct 19, 2023

Example:

var iterator = IntList.of(1, 1).subList(1, 2).iterator();
while (iterator.hasNext()) iterator.nextInt();

throws java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2.
It's reproducible with DoubleList as well. Haven't checked other types though.

Possible workaround: replace IntList with IntArrayList.

Affected version: fastutil-core:8.5.12.

I guess, the problem is in missing addition of from inside hasNext method.

@techsy730
Copy link
Contributor

Sounds like a (hopefully) simple fix; I can try to make a merge request for it

@vigna
Copy link
Owner

vigna commented Dec 4, 2023

Ouch, I completely missed this somehow. Yes, if you can fix it in a PR that'd be great. I'd like to fix a few things and release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants