I would like to see JDK standard "array builders" for primitive types and
reference types that use fixed sized (power-of-two) segments internally.
I want to caution on the power-of-two idea – it leads to large objects faster
than the current implementation, which hurts performance as well as max
capacity. There is value in fixed-size options but we would want something
with a slower rate of growth.
The "underlying problem" that I think should be addressed by some new internal
class (or suite of classes) is the "array builder" problem. This is where
you're doing "append, append, append, ..., use read-only thereafter".
I would prefer targeting a few, common use cases – ByteArrayOutputStream is the
example that got us here. Optimizing forward-only handling is an easy starting
place and we can always add on later.
John