簡體   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