set接口的小细节

1.set集合,不能加入重复的元素,而且是无序的,null只能有一个

2.set接口的子类,HashSet,TreeSet

3.set接口没有提供get()方法

4.HashSet类

2.TreeSet类

5.HashSet重复元素,必须覆写equals()方法与hashCode()方法

加了hashcode方法与equals方法之后就不会有重复元素了

猜你喜欢

转载自blog.csdn.net/z_ssyy/article/details/82531760
今日推荐