diff options
Diffstat (limited to 'java/core/src/main/java/com/google/protobuf/FloatArrayList.java')
-rw-r--r-- | java/core/src/main/java/com/google/protobuf/FloatArrayList.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/java/core/src/main/java/com/google/protobuf/FloatArrayList.java b/java/core/src/main/java/com/google/protobuf/FloatArrayList.java index 76645583..7c080af3 100644 --- a/java/core/src/main/java/com/google/protobuf/FloatArrayList.java +++ b/java/core/src/main/java/com/google/protobuf/FloatArrayList.java @@ -82,6 +82,18 @@ final class FloatArrayList extends AbstractProtobufList<Float> } @Override + protected void removeRange(int fromIndex, int toIndex) { + ensureIsMutable(); + if (toIndex < fromIndex) { + throw new IndexOutOfBoundsException("toIndex < fromIndex"); + } + + System.arraycopy(array, toIndex, array, fromIndex, size - toIndex); + size -= (toIndex - fromIndex); + modCount++; + } + + @Override public boolean equals(Object o) { if (this == o) { return true; @@ -246,7 +258,9 @@ final class FloatArrayList extends AbstractProtobufList<Float> ensureIsMutable(); ensureIndexInRange(index); float value = array[index]; - System.arraycopy(array, index + 1, array, index, size - index); + if (index < size - 1) { + System.arraycopy(array, index + 1, array, index, size - index); + } size--; modCount++; return value; |