【问题标题】:Java - How to prove Set is using Map as the internal data structure to store the elements?Java - 如何证明 Set 使用 Map 作为内部数据结构来存储元素?
【发布时间】:2017-07-15 10:40:20
【问题描述】:

我知道java Set使用map作为内部数据结构来存储元素。但我想证明这一点。怎么证明?

https://www.javatpoint.com/q/7105/what-is-the-data-structure-that-a-set-uses-to-store-its-elements?

【问题讨论】:

标签: java dictionary collections set


【解决方案1】:

我非常怀疑 interface Set 的所有实现是否都是如此。

我发现 HashSet 正确的方法是我在 eclipse 中检查了一个 HashSet 对象。

这应该可以让您向您的大学展示它。如需更多证据,请查看@RC 链接的源代码。

【讨论】:

  • 确实,EnumSet 不是使用Map 实现的。
猜你喜欢
  • 2012-09-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-03
  • 2013-03-11
  • 2020-01-31
  • 1970-01-01
相关资源
最近更新 更多