J. K. J. K. - 1 year ago 92
Java Question

When to use Android's ArrayMap instead of a HashMap?

Android have their own implementation of HashMap, which doesnt use Autoboxing and it is somehow better for performance (CPU or RAM)?


From what I read here, I should replace my HashMap objects with ArrayMap objects if I have HashMaps whose size is below hundreds of records and will be frequently written to. And there is no point in replacing my HashMaps with ArrayMaps if they are going to contain hundreds of objects and will be written to once and read frequently. Am I Correct?

Answer Source

Is there any reason for you to attempt such a replacement?

If it's to improve performance then you have to make measures before and after the replacement and see if the replacements helped.

Probably, not worth of the effort.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download