相同点:单例集合,数据不可重复
不同点1:底层使用的储存数据结构不同:
hashset无序 Treeset有序
储存原理:
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/204530.html原文链接:https://javaforall.net
HashSet和TreeSet的区别相同点 单例集合 数据不可重复 nbsp nbsp nbsp nbsp nbsp nbsp 不同点 1 底层使用的储存数据结构不同 nbsp nbsp nbsp 1 Hashset 底层使用的是 HashMap 哈希表结构储存 nbsp nbsp nbsp nbsp 2 而 Treeset 底层用的是 TreeMap 树结构储存 nbsp nbsp nbsp nbsp nbsp nbsp 不同点 2 储存的数据保存唯一方式不用 nbsp nbsp nbsp nbsp 1 Hashset 是通过复写 hashCode 方法和 equals 方法来保证的 nbsp
相同点:单例集合,数据不可重复
不同点1:底层使用的储存数据结构不同:
hashset无序 Treeset有序
储存原理:
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/204530.html原文链接:https://javaforall.net