Developing a program which uses hash map with integer as keys and objects as values. I keep on getting Lint warning informing SparseArray is more efficient and when I read about the same it was given in this Link that, there can be gaps in the indices. What does that actually mean, I am not able to get.
Does it mean, if I have keys like 1,5, 10 then array size will be 3 with indices 1, 5, 10. (Or) array size will be 11 with objects present for 1, 5, 10 indices and rest are empty?
Please clarify me.
It makes sense more if you look at the source code for SparseArray. All it has is two arrays - one containing the keys and the other containing the values; so your first reasoning is correct.