goldmansachs / gs-collections

GS Collections has been migrated to the Eclipse Foundation, re-branded as Eclipse Collections. https://www.eclipse.org/collections/
https://www.eclipse.org/collections/
1.81k stars 275 forks source link

relax visibility of arraylist items / ability to addAll efficiently #19

Closed phraktle closed 9 years ago

phraktle commented 9 years ago

If one wants to append a IntArrayList to another IntArrayList, there's an extra copy involved due to the call to toArray():

   public boolean addAll(IntIterable source)
    {
        return this.addAll(source.toArray());
    }

Also, please relax the visibility of items to protected, so one can subclass this collection. As I understand, that was the design rationale for FastList vs. JDK ArrayList, but looks like the same mistake is repeated here :)

goldmansachs commented 9 years ago

Thanks for reporting this. We'll pick this up in the next minor release.