I am new to developing in android. In my android app I\'m using HashMap
, but I\'m getting a warning:
**\"Use new SparseArray(...) ins
SparseArray
is used when you are using an Integer
as a key.
When using the SparseArray
, the key will stay as a primitive variable at all times unlike when you use the HashMap
where it is required to have a Object
as a key which will cause the int to become an Integer
object just for a short time while getting the object in the map.
By using the SparseArray
you will save the Garbage Collector some work.
So use just like a Map
.