Collection框架及List集合
集合框架概述
在实际开发中,需要将使用的对象存储于特定数据结构的容器中。JDK提供了这样的容器----集合框架,集合框架中包含了一系列不同数据结构(线性表、查找表)的实现类。
interface
Collection
interface interface interface
List Set Map
ArrayList LinkedList HashSet TreeSet HashMap TreeMap
Collection常用方法
int size(); 返回包含对象的个数
boolean isEmpty(); 返回是否为空
boolean contains(Object o); 判断是否包含指定对象
void clear(); 清空集合
boolean add(E e); 向集合中添加对象
boolean remove(Object o); 从集合中删除对象
boolean addAll(Collection<? extends E> c); 将另一集合中的所有元素添加到集合中
boo