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

Isn't Android's Bundle functionally equivalent with a Map ?

Câu trả lời

No, Android's Bundle is not functionally equivalent to a Map. While both are used to store key-value pairs, there are several important differences:

  1. A Map can have keys of any type, while a Bundle requires String keys[1].

  2. A Bundle implements Parcelable, which is important for Android IPC (Inter-Process Communication). It allows Bundles to be used as service parameters and attached to Intents or passed into Activities. In contrast, Map is an interface and does not extend Parcelable[1].

  3. A Bundle is optimized for storing and retrieving primitive types and String values efficiently. It uses a more compact binary format compared to Map[2].

  4. **Bundle provides convenience methods like getInt(), getString(), etc. to retrieve values of specific types, while a `Map...

middle

middle

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

junior

What types of Context do you know?

entry

What is the difference between Bitmap and Drawable in Android?

senior

What are best practices for storing and protecting private API keys in applications?

Bình luận

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

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