diff options
| author | Kweku Adams <kwekua@google.com> | 2019-04-29 11:47:41 -0700 |
|---|---|---|
| committer | Kweku Adams <kwekua@google.com> | 2019-04-29 11:47:41 -0700 |
| commit | 3858b2d1dcd9a5105f6a895b25d215a1d31ae5bc (patch) | |
| tree | 8977e4a65ff3911f140078fba689261a0d56bf07 /core/java/android/util/SparseBooleanArray.java | |
| parent | ebc87475460adefb5c8c7ce8e36178162bd51934 (diff) | |
Add extra comment for implementation.
Add a comment noting that the check to throw the exception is
intentionally second so that it's out of the critical path.
Bug: 118339123
Test: N/A
Change-Id: I36c5ea67579bcd7906f711530392110d9987ffb4
Diffstat (limited to 'core/java/android/util/SparseBooleanArray.java')
| -rw-r--r-- | core/java/android/util/SparseBooleanArray.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/java/android/util/SparseBooleanArray.java b/core/java/android/util/SparseBooleanArray.java index 557404764aed..d6e0e53a210d 100644 --- a/core/java/android/util/SparseBooleanArray.java +++ b/core/java/android/util/SparseBooleanArray.java @@ -175,6 +175,7 @@ public class SparseBooleanArray implements Cloneable { public int keyAt(int index) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. + // Check if exception should be thrown outside of the critical path. throw new ArrayIndexOutOfBoundsException(index); } return mKeys[index]; @@ -199,6 +200,7 @@ public class SparseBooleanArray implements Cloneable { public boolean valueAt(int index) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. + // Check if exception should be thrown outside of the critical path. throw new ArrayIndexOutOfBoundsException(index); } return mValues[index]; @@ -215,6 +217,7 @@ public class SparseBooleanArray implements Cloneable { public void setValueAt(int index, boolean value) { if (index >= mSize && UtilConfig.sThrowExceptionForUpperArrayOutOfBounds) { // The array might be slightly bigger than mSize, in which case, indexing won't fail. + // Check if exception should be thrown outside of the critical path. throw new ArrayIndexOutOfBoundsException(index); } mValues[index] = value; |
