diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2018-09-07 16:15:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-07 16:15:38 -0700 |
commit | f9d8138376765d229a32635c9209061e4e4aed8c (patch) | |
tree | 50719686fd7262f405c9bda8694d6c72e7c038b8 /java/core/src/main/java/com/google/protobuf/LongArrayList.java | |
parent | 2e7563f40ec7f901ae8ae1cc749d701fa07e211d (diff) | |
parent | e53be9bce4556cf0d13e24f1a25a7d75f663144f (diff) | |
download | protobuf-f9d8138376765d229a32635c9209061e4e4aed8c.tar.gz protobuf-f9d8138376765d229a32635c9209061e4e4aed8c.tar.bz2 protobuf-f9d8138376765d229a32635c9209061e4e4aed8c.zip |
Merge pull request #5109 from haberman/integrate
Down-integrate from google3.
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 | 23 |
1 files changed, 7 insertions, 16 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 9a5056be..8cdab121 100644 --- a/java/core/src/main/java/com/google/protobuf/LongArrayList.java +++ b/java/core/src/main/java/com/google/protobuf/LongArrayList.java @@ -42,11 +42,11 @@ import java.util.RandomAccess; * * @author dweis@google.com (Daniel Weis) */ -final class LongArrayList - extends AbstractProtobufList<Long> +final class LongArrayList extends AbstractProtobufList<Long> implements LongList, RandomAccess, PrimitiveNonBoxingCollection { private static final LongArrayList EMPTY_LIST = new LongArrayList(); + static { EMPTY_LIST.makeImmutable(); } @@ -55,9 +55,7 @@ final class LongArrayList return EMPTY_LIST; } - /** - * The backing store for the list. - */ + /** The backing store for the list. */ private long[] array; /** @@ -66,16 +64,13 @@ final class LongArrayList */ 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; @@ -169,17 +164,13 @@ final class LongArrayList 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) { |