This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes Vector elements into Iterator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Vector elements into Iterator" Watch "Vector elements into Iterator" New topic

Vector elements into Iterator

Ravi Kumar Ravuru
Ranch Hand

Joined: Apr 18, 2002
Posts: 176
Hello Friends,
How can i get the vector elements into Iterator collections object?
Thanks in advance.
Vikas Varma

Joined: Aug 21, 2002
Posts: 23
I think it could be done in this way..
java.util.Vector v = new java.util.Vector();
for (int i = 0; i < 10; i++) {
v.addElement("element " + i);
java.util.Iterator itr = new java.util.Iterator();
itr = v.iterator();
while (itr.hasNext()) {
//Do your stuff
System.out.prinltn("element " +;
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056

Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Ravi Kumar Ravuru
Ranch Hand

Joined: Apr 18, 2002
Posts: 176
Hello Vikas Varma & Ron Newman,
Thanks for your help.
I agree. Here's the link:
subject: Vector elements into Iterator
Similar Threads
How to make a loop with List Iterator...
Iterator vs forloop....
How to check duplicates in hashmap
how to debug Concurrent Modification Exception?