Is there a writable iterator in Java?

Posted by Lukasz Lew on Stack Overflow See other posts from Stack Overflow or by Lukasz Lew
Published on 2010-05-10T12:31:35Z Indexed on 2010/05/10 12:34 UTC
Read the original article Hit count: 204

Filed under:
|
|
|

In C+ one can use iterators for writing to a sequence. Simplest example would be:

vector<int> v;
for (vector<int>::iterator it = v.begin(); it!=v.end(); ++it) {
    *it = 42;
}

I need something more complicated - keep iterator as a class member for a later use. But I don't know how to get this behavior from Java iterators.

Are there writable iterators in Java at all?
If not then what replaces them?

© Stack Overflow or respective owner

Related posts about java

Related posts about array