java基础——Vector集合知识点



package test_day_9;

import java.util.Enumeration;
import java.util.Iterator;
import java.util.Vector;
//Vector 底层是数组结构,查询可增删都很慢,是同步的
public class VectorDemos {

	public static void main(String[] args) {
		
		Vector v = new Vector();
		v.add("abc1");
		v.add("abc1");
		v.add("abc1");
		v.add("abc1");
		v.add("abc1");
		
		Enumeration en = v.elements();
		while(en.hasMoreElements())
		{
			System.out.println("elenents:___"+en.nextElement());
		}
		
		Iterator it = v.iterator();
		while(it.hasNext())
		{
			System.out.println("next :"+it.next());
		}

	}

}








你可能感兴趣的:(java点滴积累,java,集合,Vector)