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

middle

What is the difference between AsyncTask and Thread/Runnable ?

senior

How to avoid reverse engineering of an APK file?

middle

What is RenderScript and when should we (really) use it?

Bình luận

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

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