1. Comparable:
A class implements Comparable, which means it own rule of comparison, like TreeSet. It need the elements we put must implements comparable interface and remember add generics.
2. Comparator:
If we want to temporarily formulate a rule of comparison, For example, Collections.sort() need to cast a instance of parameter type of Comparator, and we can handle it with lambda.
3. LinkedList:(FIFO)
add, delete, alter, check
4. Map:
①HashMap: out of order, no repeat
Method: put(key, value); get(key); containsKey(key); containsValue(value); keySet(); entrySet(); size(); clear()
*put has return value, so it can save old value when we replace.
②The relationship between HashSet and HashMap: their infrastructure of implements is by HashMap
③HashCode & equals: when map call put method, it will find the HashCode of Key, if they are same; then compared with equals.
④TreeMap: order, no repeat
⑤LinkedHashMap: order, like LinkedList, no repeat
⑥WeakHashMap: week reference, when we call the System.gc(), they will be callback.
⑦IdentityHashMap: no repeat. Judge by '==' rather than equals.
5. Properties:
Attribute class, it can store Key-Value into the file, Similarly,they can also read Key-Value into memory, We will always see the file named .properties in our future projects.
Method: p.get(); p.set(); p.load(); p.store();
Properties p =new Properties();
/*p.setProperty("Java", "100");
p.setProperty("key", "value");
p.store(System.out, "Chinese");
File f = new File("d:/a.properties");
p.store(new FileOutputStream(f), "Score");*/
File f = new File("d:/a.properties");
p.load(new FileInputStream(f));;
System.out.println(p.get("Java"));