A
Andreas Leitgeb
Mostly out of curiosity, and not so much out of any current real
need, I wonder, why Iterators are not cloneable.
I can't think of any reason, how this cloning could ever be non-
trivial to implement for any type of collection/iterator, but
perhaps someone else knows of some ferro concrete strong reasons
why this could be a bad idea, and cares to let me know?
By googling I found (from more than two years ago):
http://www.velocityreviews.com/foru...terator-or-an-equivalent-solution-needed.html
where two "solutions" (*) were suggested (by Patricia and Eric),
which both do not appear like satisfactory abstract solutions,
but rather workarounds for current non-cloneability.
* namely toArray() being one, and the other was: iterating the inner
loop from 0 to current element, rather than from current to end -
but how can I even detect, when two iterators sit on the the same
spot, if the collection had no uniqueness constraint in the first
place?
need, I wonder, why Iterators are not cloneable.
I can't think of any reason, how this cloning could ever be non-
trivial to implement for any type of collection/iterator, but
perhaps someone else knows of some ferro concrete strong reasons
why this could be a bad idea, and cares to let me know?
By googling I found (from more than two years ago):
http://www.velocityreviews.com/foru...terator-or-an-equivalent-solution-needed.html
where two "solutions" (*) were suggested (by Patricia and Eric),
which both do not appear like satisfactory abstract solutions,
but rather workarounds for current non-cloneability.
* namely toArray() being one, and the other was: iterating the inner
loop from 0 to current element, rather than from current to end -
but how can I even detect, when two iterators sit on the the same
spot, if the collection had no uniqueness constraint in the first
place?