[PATCH] Inefficient ArrayList.subList().toArray()

John Rose john.r.rose at oracle.com
Tue Jan 30 00:09:00 UTC 2018

On Jan 29, 2018, at 4:00 PM, John Rose <john.r.rose at oracle.com> wrote:
> Then the various array-backed implementations
> (and their sublists) would simply override their respective
> stream views.  

BTW, this notion is more general than you might think.
It applies to collections, like the internal spined buffer,
which are backed by sequences of arrays.  You use
the spliterator of the array-backed stream to find
the "cracks" between the backing arrays.  After
subdividing appropriately, you get Arrays.copyOf
and its friends at the leaves of the outer loop.

As I said, I *think* this can work, and if it does
it will address the issue of duplicate or slow copies
more systematically than slowly expanding but
incomplete set of point-fixes, like the one under

More information about the core-libs-dev mailing list