class HashSet implements Set {
private static final Object PRESENT = new Object();
private transient HashMap<E,Object> map;
public HashSet() {
map = new HashMap<>();
}
public boolean add(E e) { //e=hello,world
return map.put(e, PRESENT)==null;
}
}
private static final Object PRESENT = new Object();这里的PRESENT是什么变量,看了半天源码没有看懂?
transient,这个关键字有什么意义吗?求解?
|
|