Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Vector<Vector> v = new Vector<Vector> problem to loop

843789Nov 21 2009 — edited Nov 21 2009
Hello. I have this enoying problem. ill just show it with code.
Vector<Vector> v = new Vector<Vector>();
Vector<String> s = new Vector<String>();

s.addElement("a");
s.addElement("b");
s.addElement("c");

v.add(s);
This is how it looks. Now i would like to loop it out using Iterator.
Object done = null;
Iterator itr = v.iterator();
  while (itr.hasNext()){
  done = itr.next();
}
The loop just goes thrue the first Vector, and the Object done now has the result [a,b,c]. How can i now loop the Object done so the result will be a,b,c.

Edited by: MagnusT76 on Nov 21, 2009 2:26 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2009
Added on Nov 21 2009
2 comments
190 views