summaryrefslogtreecommitdiff
path: root/core/java/android/util/SparseDoubleArray.java
diff options
context:
space:
mode:
authorDmitri Plotnikov <dplotnikov@google.com>2022-01-19 15:52:19 -0800
committerDmitri Plotnikov <dplotnikov@google.com>2022-01-19 18:20:29 -0800
commitbb925fb03422332b3f8fdcc5519a0b85ced0be7a (patch)
tree75c731245926d351931abbbfed861c9f2fd2a6c2 /core/java/android/util/SparseDoubleArray.java
parent2f473a976725ff8b5111d6f0cf8a3aabadae460e (diff)
Add SparseLongArray.incrementValue()
This method is used for accumulation of long values: if the key does not exist, one is created. If one already exists, the passed value is added to the previous value. This method is similar to the existing SparseDoubleArray.incrementValue() method Bug: 215427055 Test: atest FrameworksCoreTests:SparseLongArrayTest Change-Id: I771d9bc2bdd12ca4260b20186ced70f5862b6f56
Diffstat (limited to 'core/java/android/util/SparseDoubleArray.java')
-rw-r--r--core/java/android/util/SparseDoubleArray.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/android/util/SparseDoubleArray.java b/core/java/android/util/SparseDoubleArray.java
index dc93a473fe44..ccae92e53c5e 100644
--- a/core/java/android/util/SparseDoubleArray.java
+++ b/core/java/android/util/SparseDoubleArray.java
@@ -105,7 +105,7 @@ public class SparseDoubleArray implements Cloneable {
* <p>This differs from {@link #put} because instead of replacing any previous value, it adds
* (in the numerical sense) to it.
*/
- public void add(int key, double summand) {
+ public void incrementValue(int key, double summand) {
final double oldValue = get(key);
put(key, oldValue + summand);
}