繁体   English   中英

Java 数据结构/C++ STL 等价物?

[英]Java datastructures/ C++ STL equivalents?

我刚开始学习java。 我已经知道 C++ 和 python。 为了学习 Java,我有点用我在 C++ 中所知道的做类比。 我是 C++ 中 STL 库的狂热用户(向量、双端队列、堆栈、哈希图) http://www.sgi.com/tech/stl/stl_introduction.html

同时,python 在他们的文档中也有标准的字典、列表等。

我最近一直在谷歌上搜索 Java 中的 STL 等价物,但找不到? 有人可以指出我正确的资源吗?

  1. std::vector -> juArrayList
  2. std::unordered_map -> juHashMap
  3. std::map -> juTreeMap
  4. std::set -> juLinkedHashSet
  5. std::unordered_set -> juHashSet
  6. std::stack -> juArrayDeque(不推荐使用 juStack),
  7. std::queue -> 使用 juLinkedList(也看看 juArrayBlockingQueue)。
  8. std::priority_queue -> juPriorityQueue
  9. std::span -> 没有明确的类似物
  10. std::deque -> juArrayDeque
  11. std::list -> juLinkedList
  12. std::forward_list -> 没有类似物

重要提示:上述关联具有相似的 API,但可能具有不同的操作和实现渐近线。

注意: ju表示java.util

Oracle深入解释了这里的链接

如果您想了解常见容器,请查看此处链接

这是Collections API的官方页面: http//docs.oracle.com/javase/tutorial/collections/index.html

我还推荐Bruce Eckel撰写的Thinking in Java一书。 (http://mindview.net/Books/TIJ4)“持有你的对象章节”提供了一个介绍,“容器深度章节”提供了更多信息(包括性能考虑因素)。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM