diff options
| author | Winson <chiuwinson@google.com> | 2021-02-24 11:57:46 -0800 |
|---|---|---|
| committer | Winson <chiuwinson@google.com> | 2021-02-24 12:58:06 -0800 |
| commit | 84bf25d6d3bcb52ed15bd21403dd4d52f3dce34a (patch) | |
| tree | 665d6ea44fda7434ce9690599edbd6bc2561665f /core/java/android | |
| parent | 0f47704827facbe2c64f2bf55bab756c8da26f69 (diff) | |
Accept generic in SparseArray contentEquals
Also updates the JavaDoc.
Bug: 181100924
Test: atest android.util.cts.SparseArrayTest
Change-Id: I3704b2519d10e20d02437037c7f92f5d2ed90dcd
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/util/SparseArray.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/util/SparseArray.java b/core/java/android/util/SparseArray.java index 6718e93f908c..05c8617294da 100644 --- a/core/java/android/util/SparseArray.java +++ b/core/java/android/util/SparseArray.java @@ -510,10 +510,12 @@ public class SparseArray<E> implements Cloneable { } /** + * Compares the contents of this {@link SparseArray} to the specified {@link SparseArray}. + * * For backwards compatibility reasons, {@link Object#equals(Object)} cannot be implemented, * so this serves as a manually invoked alternative. */ - public boolean contentEquals(@Nullable SparseArray<E> other) { + public boolean contentEquals(@Nullable SparseArray<?> other) { if (other == null) { return false; } @@ -534,6 +536,9 @@ public class SparseArray<E> implements Cloneable { } /** + * Returns a hash code value for the contents of this {@link SparseArray}, combining the + * {@link Objects#hashCode(Object)} result of all its keys and values. + * * For backwards compatibility, {@link Object#hashCode()} cannot be implemented, so this serves * as a manually invoked alternative. */ |
