美文网首页
[持续]Java学习采坑

[持续]Java学习采坑

作者: 清水芦苇 | 来源:发表于2017-12-21 15:14 被阅读40次

    JDK 1.7和 JDK 7 其实是一回事

    可参考 版本控制系统的改变

    HashMap 和 Map 的关系

    HashMap 是对 Map 的实现。

    jdk 中 HashMap 的源码

    补充知识:
    Map has following implementations:

    • HashMap
    • LinkedHashMap
    • Tree Map
    • WeakHashMap
    Java 中 Map 的实现
    • Map 是“键值对”映射的抽象接口。
    • AbstractMap 实现了Map中的绝大部分函数接口。它减少了“Map的实现类”的重复编码。
    • SortedMap 有序的“键值对”映射接口。
    • NavigableMap 是继承于SortedMap的,支持导航函数的接口。
    • HashMap, Hashtable, TreeMap, WeakHashMap 这4个类是“键值对”映射的实现类。它们各有区别!
      HashMap 是基于“拉链法”实现的散列表。一般用于单线程程序中。
      Hashtable 也是基于“拉链法”实现的散列表。它一般用于多线程程序中。
      WeakHashMap 也是基于“拉链法”实现的散列表,它一般也用于单线程程序中。相比HashMap,WeakHashMap中的键是“弱键”,当“弱键”被GC回收时,它对应的键值对也会被从WeakHashMap中删除;而HashMap中的键是强键。
      TreeMap 是有序的散列表,它是通过红黑树实现的。它一般用于单线程中存储有序的映射。

    可参考:
    https://stackoverflow.com/questions/1348199/what-is-the-difference-between-the-hashmap-and-map-objects-in-java
    Java 集合系列14之 Map总结

    HashSet 和 HashMap 之间的关系

    HashSet 是在 HashMap 上又封装了一层,并且只需要用到 key 属性就好,不关心 value 部分。HashSet 是模仿数学上的 set 抽象而设计的,在 HashSet 中的键值不能重复。
    参考:Java-HashSet工作原理及实现

    Eclipse 操作方面的技巧

    java.util.HashMap 按着 ctrl 可以看到 HashMap 的 jdk 源码(但是首先得给对应的包指定源码位置)

    给对应的包指定源码位置
    否则提示 Source not found.
    否则提示 Source not found
    下载 jdk 时会附带源码包
    其中有用的是:commons-codec-1.11.jar

    学习资料 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.

    上课的课件(持续更新)

    Lectures: http://www.cs.unc.edu/~kmp/comp401fall17/lectures

    例子代码

    Lecture Example Code: http://www.cs.unc.edu/~kmp/comp401fall17/lecture_code

    作业现在已经做到的四个

    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

    相关文章

      网友评论

          本文标题:[持续]Java学习采坑

          本文链接:https://www.haomeiwen.com/subject/rqqluxtx.html