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