Collection体系中有单列集合(list)和双列集合(set)
list接口下有:ArrayList,LnkedList和Vector三个子类
set接口下有:HashSet和TreeSet子类
为什么会出现这么多的容器呢?
因为每一个容器对数据的存储方式不同,这种存储方式称之为存储结构
Collection定义了集合框架的共性功能。
1,添加
add(e);
addAll(collection);
2,删除
remove(e);
removeAll(collection);
clear();
3,判断。
contains(e);
isEmpty();
4,获取
iterator();
size();
5,获取交集。
retainAll();
6,集合变数组。
toArray();
注意
1,add方法的参数类型是Object。以便于接收任意类型对象。
2,集合中存储的都是对象的引用(地址)
迭代器