|
|
|
@ -197,10 +197,7 @@ final class BooleanArrayList extends AbstractProtobufList<Boolean> |
|
|
|
|
if (size == array.length) { |
|
|
|
|
// Resize to 1.5x the size
|
|
|
|
|
int length = ((size * 3) / 2) + 1; |
|
|
|
|
boolean[] newArray = new boolean[length]; |
|
|
|
|
|
|
|
|
|
System.arraycopy(array, 0, newArray, 0, size); |
|
|
|
|
array = newArray; |
|
|
|
|
array = Arrays.copyOf(array, length); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
array[size++] = element; |
|
|
|
@ -219,14 +216,10 @@ final class BooleanArrayList extends AbstractProtobufList<Boolean> |
|
|
|
|
} else { |
|
|
|
|
// Resize to 1.5x the size
|
|
|
|
|
int length = ((size * 3) / 2) + 1; |
|
|
|
|
boolean[] newArray = new boolean[length]; |
|
|
|
|
|
|
|
|
|
// Copy the first part directly
|
|
|
|
|
System.arraycopy(array, 0, newArray, 0, index); |
|
|
|
|
array = Arrays.copyOf(array, length); |
|
|
|
|
|
|
|
|
|
// Copy the rest shifted over by one to make room
|
|
|
|
|
System.arraycopy(array, index, newArray, index + 1, size - index); |
|
|
|
|
array = newArray; |
|
|
|
|
System.arraycopy(array, index, array, index + 1, size - index); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
array[index] = element; |
|
|
|
|