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
It's a hint that there is a better data structure for your code.
That hint is from Lint. You usually get it when you have a HashMap
of integers to something else.
Its biggest advantage is to treat the integer key as a primitive. In other words, it won't covert to an Integer
(the Java object) to use it as a key.
This is a big deal when using large maps. HashMap
will result in the creation of many, many Integer
objects in that case.
See a few more pieces of information here.