Iterators - can you assign new values to them?
I know an Iterator object has the hasNext(), next(), and remove() methods, but is there a way to assign a different value to an Iterator object as you iterate through? For instance:
Code:
Vector v = new Vector();
v.add(1);
v.add(2);
v.add(3);
for (Iterator i = v.iterator; i.hasNext(); ) {
// set current i value to its value times 10
}
What would be the code to replace the comment line in the preceding code without having to use the set() method of the Vector object itself on the v vector? Thanks for your help!
-Derek Raimann