简体   繁体   English

Android:Bundle Vs java.util collections 和 Z063A5BC470661C971C7909BCE1 有什么区别

[英]Android: what is the difference between Bundle Vs java.util collections like HashMap

What is the difference between Bundle Vs java.util collections like HashMap? Bundle Vs java.util collections 和 HashMap 有什么区别?

One difference I can see easily is that a Bundle allows you to put int, boolean, etc., into it while a HashMap seems to require you to convert them to/from objects.我可以轻松看到的一个区别是,Bundle 允许您将 int、boolean 等放入其中,而 HashMap 似乎需要您将它们转换为对象或从对象转换为对象。

A more important difference is that with a Bundle, every object it contains is parcelable.一个更重要的区别是,对于一个 Bundle,它包含的每个 object 都是可包裹的。 This allows Bundles to be used as service parameters and to be attached to intents / passed into activities.这允许捆绑包用作服务参数并附加到意图/传递到活动中。

A Bundle in Android is a tool the apps use to handle resources. Android 中的 Bundle 是应用程序用来处理资源的工具。 It has built in structure that lets the OS search bundles hierarchically to find a specific resource.它具有内置结构,可让操作系统分层搜索捆绑包以查找特定资源。

Yes, it is essentially a hash map, but it designed to be a specialized Android component, and not a general purpose data structure.是的,它本质上是一个 hash map,但它被设计为一个专用的 Android 组件,而不是通用数据结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 同步块中的 HashMap 与 Collections.synchronizedMap() 有什么区别。 - What is difference between HashMap in synchronized block vs Collections.synchronizedMap(). Joda LocalDate和java.util的日期有什么区别? - What are the differences between Joda LocalDate and java.util's Date? Java Util Function和Collections4 Transformer有什么区别? - What's the difference between Java Util Function and Collections4 Transformer? 未解决的参考 arraylist: java.util vs kotlin.Z0B9ABFE67CC31FCF1ECD022EB1 导入问题 - Unresolved reference arraylist : java.util vs kotlin.collections import issue java.util包 - 类和接口 - java.util package - classes vs interfaces Package java.util和Package java.sql中Date类的区别 - Difference between Date class in Package java.util & Package java.sql java.util中的Base64与commons-net软件包之间的区别? - Difference between Base64 in java.util and commons-net packages? 无法找到bundle java.util的资源 - Can't find resource for bundle java.util 什么是 Java 8 功能方式来实现类似 switch 的构造,而无需仅使用 java.util 的“switch”和“if”语句 - What is Java 8 functional way to implement switch-like construction without “switch” and “if” statements using only java.util 在Mac上缺少java.util时该怎么办 - What to do when java.util is missing on a Mac
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM