Vector iterator
package com.baeldung.java.list;
import java.util.Enumeration;
+import java.util.Iterator;
import java.util.Vector;
public class VectorExample {
@@ -16,6 +17,11 @@ public class VectorExample {
while(e.hasMoreElements()){
System.out.println(e.nextElement());
}
+
+ Iterator<String> iterator = vector.iterator();
+ while (iterator.hasNext()) {
+ System.out.println(iterator.next());
+ }
}
}
