Merge "Fix LongArray.addAll() to use correct arraycopy argument order"
diff --git a/core/java/android/util/LongArray.java b/core/java/android/util/LongArray.java
index 7d42063..290a89b 100644
--- a/core/java/android/util/LongArray.java
+++ b/core/java/android/util/LongArray.java
@@ -83,7 +83,7 @@
final int count = values.mSize;
ensureCapacity(count);
- System.arraycopy(mValues, mSize, values.mValues, 0, count);
+ System.arraycopy(values.mValues, 0, mValues, mSize, count);
mSize += count;
}
@@ -127,6 +127,9 @@
* Returns the value at the specified position in this array.
*/
public long get(int index) {
+ if (index >= mSize) {
+ throw new ArrayIndexOutOfBoundsException(mSize, index);
+ }
return mValues[index];
}
@@ -148,6 +151,9 @@
* Removes the value at the specified index from this array.
*/
public void remove(int index) {
+ if (index >= mSize) {
+ throw new ArrayIndexOutOfBoundsException(mSize, index);
+ }
System.arraycopy(mValues, index, mValues, index + 1, mSize - index);
}