Am 08.05.2015 um 13:28 schrieb Aleksey Shipilev:
On 05/07/2015 06:00 PM, Ulf Zibis wrote:
May be:
..., then a new internal array becomes allocated and refilled with
greater capacity.

... to give a hint, that this action may be expensive.
The Javadoc already says "If the current capacity is less than the
argument, then a new internal array is allocated with greater capacity",
which seems to be what you are saying.

Allocating a new array is one thing, but copying the old data into the new one is another story where the cost is dependent on it's size. Also theoretically, AbstractStringBuilder could hold multiple arrays to avoid the copying and solve memory fragmentation issues. Both aspects are implementation details, so when mentioned in Javadoc, my thought is, to do that in completeness. Maybe there is a better wording than "refill" to indicate the internal copying.

-Ulf

Reply via email to