Hashmap vs Bundle - Android Efficiency and Performance Comparison

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?

+5
source share
2 answers

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.

In addition, Bundlethey were not intended for general purpose data structures.

+1
source

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 , .

0

All Articles