diff options
| author | Neil Fuller <nfuller@google.com> | 2018-07-03 18:46:10 +0100 |
|---|---|---|
| committer | Neil Fuller <nfuller@google.com> | 2018-07-04 09:11:08 +0100 |
| commit | baae7fa3578e7667e8b79dfd9f2a5bd9a308092b (patch) | |
| tree | 17c4359e2c561c2c51aa98a7b29b8964f67c1911 /core/java/android/util/LongArray.java | |
| parent | 9916d4b3e89b1faf8b658cc3924e0b30cc46958a (diff) | |
Track changes in libcore to remove a constructor
Track changes in libcore to remove a constructor + lint
import order changes. Instead of the constructor a utility
method is introduced.
Test: Build / boot
Bug: 111055375
Merged-In: Id683a9d9d6e27d4c8df623dae189da9e74a6d410
Change-Id: Id683a9d9d6e27d4c8df623dae189da9e74a6d410
Diffstat (limited to 'core/java/android/util/LongArray.java')
| -rw-r--r-- | core/java/android/util/LongArray.java | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/core/java/android/util/LongArray.java b/core/java/android/util/LongArray.java index 9b0489ca5c6e..9ddb0e21692a 100644 --- a/core/java/android/util/LongArray.java +++ b/core/java/android/util/LongArray.java @@ -18,9 +18,11 @@ package android.util; import com.android.internal.util.ArrayUtils; import com.android.internal.util.Preconditions; -import java.util.Arrays; + import libcore.util.EmptyArray; +import java.util.Arrays; + /** * Implements a growing array of long primitives. * @@ -102,7 +104,7 @@ public class LongArray implements Cloneable { ensureCapacity(1); int rightSegment = mSize - index; mSize++; - checkBounds(index); + ArrayUtils.checkBounds(mSize, index); if (rightSegment != 0) { // Move by 1 all values from the right of 'index' @@ -162,7 +164,7 @@ public class LongArray implements Cloneable { * Returns the value at the specified position in this array. */ public long get(int index) { - checkBounds(index); + ArrayUtils.checkBounds(mSize, index); return mValues[index]; } @@ -170,7 +172,7 @@ public class LongArray implements Cloneable { * Sets the value at the specified position in this array. */ public void set(int index, long value) { - checkBounds(index); + ArrayUtils.checkBounds(mSize, index); mValues[index] = value; } @@ -192,7 +194,7 @@ public class LongArray implements Cloneable { * Removes the value at the specified index from this array. */ public void remove(int index) { - checkBounds(index); + ArrayUtils.checkBounds(mSize, index); System.arraycopy(mValues, index + 1, mValues, index, mSize - index - 1); mSize--; } @@ -210,10 +212,4 @@ public class LongArray implements Cloneable { public long[] toArray() { return Arrays.copyOf(mValues, mSize); } - - private void checkBounds(int index) { - if (index < 0 || mSize <= index) { - throw new ArrayIndexOutOfBoundsException(mSize, index); - } - } } |
