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