diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2009-02-19 10:57:31 -0800 | 
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-02-19 10:57:31 -0800 | 
| commit | 3001a035439d8134a7d70d796376d1dfbff3cdcd (patch) | |
| tree | 343ccdba15a594ff6e50c874a145232753315a30 /core/java/android/util | |
| parent | da996f390e17e16f2dfa60e972e7ebc4f868f37e (diff) | |
| download | frameworks_base-3001a035439d8134a7d70d796376d1dfbff3cdcd.zip frameworks_base-3001a035439d8134a7d70d796376d1dfbff3cdcd.tar.gz frameworks_base-3001a035439d8134a7d70d796376d1dfbff3cdcd.tar.bz2 | |
auto import from //branches/cupcake/...@132276
Diffstat (limited to 'core/java/android/util')
| -rw-r--r-- | core/java/android/util/SparseIntArray.java | 13 | 
1 files changed, 10 insertions, 3 deletions
| diff --git a/core/java/android/util/SparseIntArray.java b/core/java/android/util/SparseIntArray.java index 610cfd4..9ab3b53 100644 --- a/core/java/android/util/SparseIntArray.java +++ b/core/java/android/util/SparseIntArray.java @@ -73,13 +73,20 @@ public class SparseIntArray {          int i = binarySearch(mKeys, 0, mSize, key);          if (i >= 0) { -            System.arraycopy(mKeys, i + 1, mKeys, i, mSize - (i + 1)); -            System.arraycopy(mValues, i + 1, mValues, i, mSize - (i + 1)); -            mSize--; +            removeAt(i);          }      }      /** +     * Removes the mapping at the given index. +     */ +    public void removeAt(int index) { +        System.arraycopy(mKeys, index + 1, mKeys, index, mSize - (index + 1)); +        System.arraycopy(mValues, index + 1, mValues, index, mSize - (index + 1)); +        mSize--; +    } + +    /**       * Adds a mapping from the specified key to the specified value,       * replacing the previous mapping from the specified key if there       * was one. | 
