简析hashset的实现原理
hashset底层为hashmap。 源码如下: /** * Constructs a new, empty set; the backing <tt>HashMap</tt> instance has * default initial capacity (16) and load factor (0.75). */ public HashSet() { map = new HashMap<>(); } 默认 initial capacity(hashmap底层数组大小)为16,load fa...阅读全文