diff options
author | Chet Haase <chet@google.com> | 2013-06-04 10:44:40 -0700 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2013-06-04 10:44:40 -0700 |
commit | 08735185f8105710e18ad02297461bec9268e514 (patch) | |
tree | 71ac76413081b75700134c3006fa4eb921d1a8a6 /core/java/android/util | |
parent | aca7d39d087741f7e88e012db95ad961f9f08955 (diff) | |
download | frameworks_base-08735185f8105710e18ad02297461bec9268e514.zip frameworks_base-08735185f8105710e18ad02297461bec9268e514.tar.gz frameworks_base-08735185f8105710e18ad02297461bec9268e514.tar.bz2 |
Use ArrayMap instead of HashMap in transitions
The new ArrayMap class is more efficient for small collections.
Transitions use maps all over the place to collect/use property
values in setting up the transition animations. Changing to ArrayMap
should be more efficient, especially in terms of memory allocations
and GCs.
Issue #9276256 Transitions: Reduce memory allocations
Change-Id: I07b7d4ba68d5a207808eca11943aa3578fa90e3e
Diffstat (limited to 'core/java/android/util')
-rw-r--r-- | core/java/android/util/ArrayMap.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/java/android/util/ArrayMap.java b/core/java/android/util/ArrayMap.java index 6da7546..edda779 100644 --- a/core/java/android/util/ArrayMap.java +++ b/core/java/android/util/ArrayMap.java @@ -206,6 +206,16 @@ public final class ArrayMap<K, V> implements Map<K, V> { } mSize = 0; } + /** + * Create a new ArrayMap with the mappings from the given ArrayMap. + */ + public ArrayMap(ArrayMap map) { + this(); + if (map != null) { + putAll(map); + } + } + /** * Make the array map empty. All storage is released. |