garydgregory commented on code in PR #755:
URL:
https://github.com/apache/commons-collections/pull/755#discussion_r4542641337
##########
src/main/java/org/apache/commons/collections4/iterators/IteratorChain.java:
##########
@@ -270,16 +295,33 @@ public E next() {
*/
@Override
public void remove() {
- lockChain();
- if (lastUsedIterator == null) {
- throw new IllegalStateException("remove() has been invoked without
next()");
+ final Deque<IteratorChain<?>> chains = new ArrayDeque<>();
Review Comment:
Addressed. After locking and validating removal state, non-`IteratorChain`
children are handled directly without allocating traversal state. The
exact-class check preserves subclass overrides and unmodifiable boundaries, and
removal state is cleared only after successful delegation. Nested removal
retains iterative traversal with identity-based cycle detection.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]