您的位置: 首页 > 文章 > set接口的小细节 set接口的小细节 分类: 文章 • 2023-03-19 15:25:45 1.set集合,不能加入重复的元素,而且是无序的,null只能有一个 2.set接口的子类,HashSet,TreeSet 3.set接口没有提供get()方法 4.HashSet类 2.TreeSet类 5.HashSet重复元素,必须覆写equals()方法与hashCode()方法 加了hashcode方法与equals方法之后就不会有重复元素了