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
Author

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.
Ravi
Vikas Varma
Greenhorn

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 " + itr.next());
}
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
vector.iterator()


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.
Ravi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Vector elements into Iterator
 
Similar Threads
How to make a loop with List Iterator...
Collections
Iterator vs forloop....
How to check duplicates in hashmap
how to debug Concurrent Modification Exception?