What is the Java equivalent of Objective-C#39;s NSDictionary?(Objective-C 的 NSDictionary 的 Java 等价物是什么?)
问题描述
Objective-C 的 NSDictionary
在 Java 中最接近的实现是什么?对我来说,它看起来像 HashMap<String, Object>
,但我对 Objective-C 很陌生.
What is the closest implementation of Objective-C's NSDictionary
in Java? To me, it looks like HashMap<String, Object>
, but I'm very new to Objective-C.
谢谢
推荐答案
NSDictionary
是一个类簇(参见 The Cocoa Fundamentals Guide),这意味着实际的实现对你是隐藏的,API用户.事实上,Foundation 框架会在运行时根据数据量等选择合适的实现.另外,NSDictionary
可以将任何 id
作为 key,而不仅仅是 NSString
(当然key对象的-hash
必须是常量).
NSDictionary
is a class cluster (see the "Class Cluster" section in The Cocoa Fundamentals Guide), meaning that the actual implementation is hidden from you, the API user. In fact, the Foundation framework will choose the appropriate implementation at run time based on amount of data etc. In addition, NSDictionary
can take any id
as a key, not just NSString
(of course, the -hash
of the key object must be constant).
因此,最接近的模拟可能是 Map
.
Thus, closest analog is probably Map<Object,Object>
.
这篇关于Objective-C 的 NSDictionary 的 Java 等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Objective-C 的 NSDictionary 的 Java 等价物是什么?


- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01