一. HashSet初识
HashSet是Java集合Set的一个实现类,Set是一个接口,其实现类除HashSet之外,还有TreeSet,并继承了Collection,HashSet集合很常用,同时也是程序员面试时经常会被问到的知识点,下面是结构图

还是一如既往地看一下类的注释
/ * This class implements the Set interface, backed by a hash table (actually a HashMap instance). It makes no guarantees as to the iteration order of the set; * in particular, it does not guarantee that the order will remain constant over time. This class permits the null element. * 这个类实现了set 接口,并且有hash 表的支持(实际上是HashMap),它不保证集合的迭代顺序 * This class offers constant time performance for the basic operations(add, remove, contai
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/202317.html原文链接:https://javaforall.net
