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

implement subList() on primitive immutable lists #1160

Closed
wants to merge 1 commit into from
Closed

implement subList() on primitive immutable lists #1160

wants to merge 1 commit into from

Conversation

sneznaj
Copy link

@sneznaj sneznaj commented Nov 23, 2021

implement subList() on primitive immutable lists

part of #1053

AbstractImmutableList defines subList() as returning an object of an inner class
but here it is implemented as returning an object of the class itself

implement subList() on primitive immutable lists

part of #1053

AbstractImmutableList defines  subList() as returning an object of an inner class
but here it is implemented as returning an object of the class itself
{
throw new UnsupportedOperationException("subList not yet implemented!");
return new ImmutableBooleanArrayList(this.BitSet.get(fromIndex, toIndex), toIndex - fromIndex)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copying the bitset is too expensive. Use a subclass instead.

{
throw new UnsupportedOperationException("subList not yet implemented!");
return new LongInterval(fromIndex, toIndex, this.step);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks wrong. The fromIndex/toIndex of the list is not the same as the from/to of the interval.

@mohrezaei
Copy link
Member

Sorry, when I asked for not using a subclass, I only meant LongInterval.
Two more things:

  • Please don't create new PRs for the same work. Just push more code to your branch. You're using master, which is a bit unusual, but it should work the same.
  • You must add tests for all the new code.

@donraab
Copy link
Contributor

donraab commented Apr 25, 2022

Closing this as two PRs with the same name could be a single PR.

@donraab donraab closed this Apr 25, 2022
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

Successfully merging this pull request may close these issues.

None yet

3 participants