private void setCapacity(int len, boolean keepData) {
if (bytes == null || bytes.length < len) {
byte[] newBytes = new byte[len];
if (bytes != null && keepData) {
System.arraycopy(bytes, 0, newBytes, 0, length);
}
bytes = newBytes;
}
}
Why does Text.setCapacity only expand the array to the length of the new
data? Why not instead set the length to double the new requested length
or 3/2 times the existing length as in ArrayList so that the array size
will grow exponentially as in most dynamic array implentations?