JDK 1.7和 JDK 7 其實是一回事
可參考 版本控制系統(tǒng)的改變
HashMap 和 Map 的關(guān)系
HashMap 是對 Map 的實現(xiàn)捣郊。
補充知識:
Map has following implementations:
- HashMap
- LinkedHashMap
- Tree Map
- WeakHashMap
- Map 是“鍵值對”映射的抽象接口黎炉。
- AbstractMap 實現(xiàn)了Map中的絕大部分函數(shù)接口巨双。它減少了“Map的實現(xiàn)類”的重復(fù)編碼。
- SortedMap 有序的“鍵值對”映射接口。
- NavigableMap 是繼承于SortedMap的,支持導(dǎo)航函數(shù)的接口。
- HashMap, Hashtable, TreeMap, WeakHashMap 這4個類是“鍵值對”映射的實現(xiàn)類紧卒。它們各有區(qū)別!
HashMap 是基于“拉鏈法”實現(xiàn)的散列表诗祸。一般用于單線程程序中跑芳。
Hashtable 也是基于“拉鏈法”實現(xiàn)的散列表。它一般用于多線程程序中直颅。
WeakHashMap 也是基于“拉鏈法”實現(xiàn)的散列表博个,它一般也用于單線程程序中。相比HashMap功偿,WeakHashMap中的鍵是“弱鍵”盆佣,當(dāng)“弱鍵”被GC回收時,它對應(yīng)的鍵值對也會被從WeakHashMap中刪除械荷;而HashMap中的鍵是強鍵共耍。
TreeMap 是有序的散列表,它是通過紅黑樹實現(xiàn)的吨瞎。它一般用于單線程中存儲有序的映射痹兜。
可參考:
https://stackoverflow.com/questions/1348199/what-is-the-difference-between-the-hashmap-and-map-objects-in-java
Java 集合系列14之 Map總結(jié)
HashSet 和 HashMap 之間的關(guān)系
HashSet 是在 HashMap 上又封裝了一層,并且只需要用到 key 屬性就好颤诀,不關(guān)心 value 部分字旭。HashSet 是模仿數(shù)學(xué)上的 set 抽象而設(shè)計的,在 HashSet 中的鍵值不能重復(fù)崖叫。
參考:Java-HashSet工作原理及實現(xiàn)
Eclipse 操作方面的技巧
java.util.HashMap
按著 ctrl 可以看到 HashMap 的 jdk 源碼(但是首先得給對應(yīng)的包指定源碼位置)
否則提示 Source not found.
下載 jdk 時會附帶源碼包
學(xué)習(xí)資料 from 錢錕
課前閱讀遗淳,大概都是一些oracle的文檔
Pre-Lecture Readings / Videos / Exercises
(8/24) Lecture 2
http://www.brighthub.com/computing/windows-platform/articles/10291.aspx
http://www.brighthub.com/computing/windows-platform/articles/11008.aspx
http://www.brighthub.com/computing/windows-platform/articles/11122.aspx
http://www.brighthub.com/computing/windows-platform/articles/11241.aspx
(8/31) Lecture 4
https://docs.oracle.com/javase/tutorial/java/data/strings.html
https://docs.oracle.com/javase/tutorial/java/data/manipstrings.html
https://docs.oracle.com/javase/tutorial/java/data/comparestrings.html
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
http://codingbat.com/doc/java-array-loops.html
(9/7) Lecture 6
https://docs.oracle.com/javase/tutorial/java/concepts/index.html
Go through all 6 pages.
(9/26) Lecture 12
https://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html
Go from this page until the questions and exercises.
上課的課件(持續(xù)更新)
Lectures: http://www.cs.unc.edu/~kmp/comp401fall17/lectures
例子代碼
Lecture Example Code: http://www.cs.unc.edu/~kmp/comp401fall17/lecture_code
作業(yè)現(xiàn)在已經(jīng)做到的四個
http://www.cs.unc.edu/~kmp/comp401fall17/assignments/a1/fall17-a1.html
http://www.cs.unc.edu/~kmp/comp401fall17/assignments/a2/fall17-a2.html
http://www.cs.unc.edu/~kmp/comp401fall17/assignments/a3/fall17-a3.html
http://www.cs.unc.edu/~kmp/comp401fall17/assignments/a4/fall17-a4.html