I am trying to understand the impact of performance when using HashMapvs a Bundlein an Android program. I understand that it Bundleis a specialized component of Android - so it makes it higher HashMapif you just need to store basic data types ( Integers, Stringetc.), and not complex objects?
HashMap
Bundle
Integer
String
Bundleactually built on top of ArrayMaps, which are memory efficient implementations of Maps. For smaller ArrayMaps, the search takes less computational time than hash calculation for a similarly filled one HashMap. But if you have more than a few hundred items, it HashMapwill work better.
ArrayMap
Map
In addition, Bundlethey were not intended for general purpose data structures.
The Bundle allows you to put String, integer, boolean, etc. in it, but the HashMap only allows a string, for others you must convert them to / from objects.
, Bundle , , . Bundles , .