一、集合
1.1 集合的继承实现关系
使用ArrayList类时,该类已经把所有抽象方法进行了重写。那么,实现Collection接口的所有子类都会进行方法重写。
Collecton接口常用的子接口有:List接口、Set接口
List接口常用的子类有:ArrayList类、LinkedList类
Set接口常用的子类有:HashSet类、LinkedHashSet类
Map接口:
1.2 集合Collection的方法
二、iterator接口
public static void main(String[] args) {
Collection<String> coll = new ArrayList<String>();
coll.add("2");
coll.add("4");
coll.add("6");
coll.add("8");
Iterator<String> it = coll.iterator();
while( it.hasNext() ) {
System.out.println(it.next());
}
}