diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-11-19 18:31:06 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-11-19 18:31:06 +0000 |
| commit | 6b8f486bd5ad681f3bce38906afe54497bed73cd (patch) | |
| tree | 4556436501dd061d5ee367db917eea4ba4e7ad96 /core/java/android/util/SparseArray.java | |
| parent | 595205d9f7de0dcdd85f18f0a6dfaaf418e52530 (diff) | |
| parent | a26ae90b4dfe9397aafa7ab15a4b3cd887ca7585 (diff) | |
Merge "Extract SparseArrayMap from QuotaController."
Diffstat (limited to 'core/java/android/util/SparseArray.java')
| -rw-r--r-- | core/java/android/util/SparseArray.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/util/SparseArray.java b/core/java/android/util/SparseArray.java index 0a15db227823..484894f98023 100644 --- a/core/java/android/util/SparseArray.java +++ b/core/java/android/util/SparseArray.java @@ -104,6 +104,14 @@ public class SparseArray<E> implements Cloneable { } /** + * Returns true if the key exists in the array. This is equivalent to + * {@link #indexOfKey(int)} >= 0. + */ + public boolean contains(int key) { + return indexOfKey(key) >= 0; + } + + /** * Gets the Object mapped from the specified key, or <code>null</code> * if no such mapping has been made. */ |
