diff options
Diffstat (limited to 'java/core/src/main/java/com/google/protobuf/BooleanArrayList.java')
-rw-r--r-- | java/core/src/main/java/com/google/protobuf/BooleanArrayList.java | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java b/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java index 4d7a9727..2c8929e5 100644 --- a/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java +++ b/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java @@ -46,6 +46,7 @@ final class BooleanArrayList extends AbstractProtobufList<Boolean> implements BooleanList, RandomAccess, PrimitiveNonBoxingCollection { private static final BooleanArrayList EMPTY_LIST = new BooleanArrayList(); + static { EMPTY_LIST.makeImmutable(); } @@ -54,9 +55,7 @@ final class BooleanArrayList extends AbstractProtobufList<Boolean> return EMPTY_LIST; } - /** - * The backing store for the list. - */ + /** The backing store for the list. */ private boolean[] array; /** @@ -65,16 +64,14 @@ final class BooleanArrayList extends AbstractProtobufList<Boolean> */ private int size; - /** - * Constructs a new mutable {@code BooleanArrayList} with default capacity. - */ + /** Constructs a new mutable {@code BooleanArrayList} with default capacity. */ BooleanArrayList() { this(new boolean[DEFAULT_CAPACITY], 0); } /** - * Constructs a new mutable {@code BooleanArrayList} - * containing the same elements as {@code other}. + * Constructs a new mutable {@code BooleanArrayList} containing the same elements as {@code + * other}. */ private BooleanArrayList(boolean[] other, int size) { array = other; @@ -168,17 +165,13 @@ final class BooleanArrayList extends AbstractProtobufList<Boolean> addBoolean(index, element); } - /** - * Like {@link #add(Boolean)} but more efficient in that it doesn't box the element. - */ + /** Like {@link #add(Boolean)} but more efficient in that it doesn't box the element. */ @Override public void addBoolean(boolean element) { addBoolean(size, element); } - /** - * Like {@link #add(int, Boolean)} but more efficient in that it doesn't box the element. - */ + /** Like {@link #add(int, Boolean)} but more efficient in that it doesn't box the element. */ private void addBoolean(int index, boolean element) { ensureIsMutable(); if (index < 0 || index > size) { |