Object[] arr = coll.toArray(); //将集合转换成数组
for (int i = 0; i < arr.length; i++) {
Student s = (Student)arr[i]; //强转成Student
System.out.println(s.getName() + "," + s.getAge());
}
c.带all的功能(了解)
boolean addAll(Collection c)
boolean removeAll(Collection c)
boolean containsAll(Collection c)
boolean retainAll(Collection c)
d.通过迭代器遍历集合
Collection c = new ArrayList();
c.add("a");
c.add("b");
c.add("c");
c.add("d");