初始向量
Vector<String> l = new Vector<>();
l.add("Amit");
l.add("Raj");
l.add("Pathak");
l.add("Sumit");
l.add("Aron");
l.add("Trek");
迭代器遍历
for (Iterator iter = l.iterator(); iter.hasNext(); ) {
String str = (String) iter.next();
System.out.println(str);
}
枚举遍历
for (Enumeration<String> iter = l.elements(); iter.hasMoreElements(); ) {
String str = iter.nextElement();
System.out.println(str);
}
标签:遍历,java,String,迭代,add,iter,枚举,str
From: https://www.cnblogs.com/guanchaoguo/p/16791515.html