Certo, è quello che ho postato prima!
Sul javadoc È ben documentato. In https://docs.oracle.com/javase/8/doc...ngBuilder.html
All'inizio spiega il concetto generale:
Every string builder has a capacity. As long as the length of the character sequence contained in the string builder does not exceed the capacity, it is not necessary to allocate a new internal buffer. If the internal buffer overflows, it is automatically made larger.
Poi per il ensureCapacity(int minimumCapacity)
Ensures that the capacity is at least equal to the specified minimum. If the current capacity is less than the argument, then a new internal array is allocated with greater capacity. The new capacity is the larger of:
The minimumCapacity argument.
Twice the old capacity, plus 2.
Probabilmente no. Ma sta a chi studia Java avere un minimo di "iniziativa personale" per documentarsi meglio magari andando anche a sbirciare tra i sorgenti del framework.![]()