aspose file tools*
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
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Vector elements into Iterator