There's SparseArray but
there are also classes for
each of the individual primitive types. There's
a SparseBooleanArray, a
SparseIntArray and so on. Deciding
whether to use these Android specific collection
classes is
a matter of performance and
memory management. For
example, the SparseArray class manages
memory more efficiently than HashMap for
the reasons I described. When
you use SparseArray, you
don't have to box the keys. That
is, you don't have to wrap primitives in
objects.
android memory tips
最新推荐文章于 2024-04-22 12:22:16 发布