集合

集合

集合:
Vector 和Enumeration 一对




Vector v = new Vector();
Enumeration e = v.elements();
e.nextElement 指示器正指向的元素对象
e.hasMoreElements 回是否还有元素



List 和Iterator 一对



ArrayList al = new ArrayList();
Iterator it = al.iterator();
it.next();
it.hasNext();


附加一句:排序使用Collections 的一个静态方法:Collections.sort(集合对象);

你可能感兴趣的:(集合)