Skip to content

Conversation

@keith-turner
Copy link
Contributor

No description provided.

@keith-turner keith-turner added this to the 2.1.5 milestone Jan 28, 2026
@Override
public Iterator<T> iterator() {
return Iterators.unmodifiableIterator(internal.iterator());
return internal.iterator();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to no longer wrap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The list created from an array does not support removal. I added a test to verify this.

@keith-turner
Copy link
Contributor Author

Seems like PreAllocatedArray could be replaced w/ a single static method like the following. May try this in main. This change is a nice optimization for 2.1.

  @SuppressWarnings("unchecked")
  public static <T> List<T> newPreallocatedList(int size){
    return Arrays.asList((T[]) new Object[size]);
  }

@keith-turner keith-turner merged commit bd6b760 into apache:2.1 Jan 28, 2026
8 checks passed
@keith-turner keith-turner deleted the prealloc-array branch January 28, 2026 20:44
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.

2 participants