Vector iterator
This commit is contained in:
parent
c52862fdd4
commit
64b205a6ce
|
@ -1,6 +1,7 @@
|
||||||
package com.baeldung.java.list;
|
package com.baeldung.java.list;
|
||||||
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
public class VectorExample {
|
public class VectorExample {
|
||||||
|
@ -16,6 +17,11 @@ public class VectorExample {
|
||||||
while(e.hasMoreElements()){
|
while(e.hasMoreElements()){
|
||||||
System.out.println(e.nextElement());
|
System.out.println(e.nextElement());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Iterator<String> iterator = vector.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
System.out.println(iterator.next());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue