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