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

后端 未结 3 700
别那么骄傲
别那么骄傲 2021-01-05 04:53

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

https://developer.android.com/re

3条回答
  •  感动是毒
    2021-01-05 05:55

    You should take a look at this video : https://www.youtube.com/watch?v=ORgucLTtTDI
    Perfect situations:
    1. small number of items (< 1000) with a lots of accesses or the insertions and deletions are infrequent enough that the overhead of doing so is not really noticed.
    2. containers of maps - maps of maps where the submaps tends to have low number of items and often iterate over then a lot of time.

提交回复
热议问题