对于Enumeration接口来说,有一种通常的 写法,如: while( en.hasMoreElements() ){ Object obj = en.nextElemetil包中包含了Java最强大的子系统之 一,这就是“集合框架”。“集合框架”是 在Java2初始版本中增加进来的,Java2版本 1.4和1.5中增强了它的功能。一个集合就是 一组对象的容器。集合的加入导致了 java.util中许多元素在构造和体系结构方面 的根本变化,它也扩展了能够应用的任务域 。所以说,集合是所有Java程序员都需要密 切关注并熟练掌握的一种技术。
Collection<E>接口 - 2
成员方法: public boolean remove(Object o) public boolean removeAll(Collection<?> c) public boolean retainAll(Collection<?> c) public void clear() public int size() public boolean isEmpty() public boolean equals(Object o)
Collection<E>接口 - 3
成员方法: public boolean contains(Object o) public boolean containsAll(Collection<?> c)
其它方法参照API文档。
List结构层次关系
List<E>接口 - 1
成员方法: public ListIterator<E> listIterator() public ListIterator<E> listIterator(int index) public void add(int index,E element) public boolean addAll(int index,Collection<? extends E> c) public E set(int index,E element) public E get(int index)