I am trying to understand the performance impact of using a HashMap
vs a Bundle
in an Android program. I understand that a Bundle
is a specialized Android component - does it therefore make it superior to a HashMap
if one needed to simply store basic data types (Integer
s, String
s etc.) and not complex objects?
Bundle
s are actually built on top of ArrayMap
s, which are memory-efficient implementations of Map
s. For smaller ArrayMap
s, a search takes less computational time than computing the hash for a similarly populated HashMap
. But if you have more than a few hundred items in it, the HashMap
will perform better.
Besides, Bundle
s were not designed to be general-purpose data structures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With