Câu hỏi phỏng vấn Android
Câu hỏi

What are the differences between ArrayList and ArrayMap ?

Câu trả lời

The main differences between ArrayList and ArrayMap are:

  • ArrayList is a resizable-array implementation of the List interface that stores a sequence of elements, while ArrayMap is a generic key-value mapping data structure that stores key-value pairs[1][2].

  • ArrayList maintains the insertion order of elements, while ArrayMap does not guarantee any specific order[1].

  • ArrayMap is designed to be more memory efficient than a traditional HashMap by keeping its mappings in an integer array of hash codes and an Object array of key-value pairs, avoiding the need for extra objects[2][4].

  • ArrayMap is generally slower than HashMap for lookups, adds and removes since it requires binary searches and inserting/deleting entries in the array. However, for small collections under a few hundred items, the performance differen...

middle

middle

Gợi ý câu hỏi phỏng vấn

middle

How would you communicate between two Fragments?

senior

What is the difference between getContext() , getApplicationContext() , getBaseContext() , and this ?

entry

What is an Activity ?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào