Set没有顺序,不可重复,类似数学中的集合
List可以重复,有顺序
在容器中,不能添加基本数据类型,得添加object
2.重写equals ,得重写hashcode。两个对象相等,它的hashcode也相等。
3.位于java.util包内。
4.Iterator接口 主要用于遍历容器,有hasNext(),next();remove()三种方法
使用 Collection c=new ArrayList();
Iterator i = c.iterator();
Set没有顺序,不可重复,类似数学中的集合
List可以重复,有顺序
在容器中,不能添加基本数据类型,得添加object
2.重写equals ,得重写hashcode。两个对象相等,它的hashcode也相等。
3.位于java.util包内。
4.Iterator接口 主要用于遍历容器,有hasNext(),next();remove()三种方法
使用 Collection c=new ArrayList();
Iterator i = c.iterator();