This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-collections.git
commit 1bd207b02cfdb1a381b914ec110bb83f5a243198 Author: Gary Gregory <[email protected]> AuthorDate: Wed Aug 12 11:13:09 2026 -0400 Simpler internal name. --- .../collections4/collection/IndexedCollection.java | 52 +++++++++++----------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/collection/IndexedCollection.java b/src/main/java/org/apache/commons/collections4/collection/IndexedCollection.java index 4213c7f07..3960fc765 100644 --- a/src/main/java/org/apache/commons/collections4/collection/IndexedCollection.java +++ b/src/main/java/org/apache/commons/collections4/collection/IndexedCollection.java @@ -49,6 +49,31 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> { // TODO: replace with MultiValuedMap + /** + * Iterator that keeps the index in sync when {@code remove()} is used. + */ + private final class IteratorDecorator extends AbstractIteratorDecorator<C> { + + private C lastReturned; + + private IteratorDecorator(final Iterator<C> iterator) { + super(iterator); + } + + @Override + public C next() { + lastReturned = super.next(); + return lastReturned; + } + + @Override + public void remove() { + super.remove(); + removeFromIndex(lastReturned); + lastReturned = null; + } + } + /** Serialization version */ private static final long serialVersionUID = -5512610452568370038L; @@ -191,7 +216,7 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> { @Override public Iterator<C> iterator() { - return new IndexedCollectionIterator(decorated().iterator()); + return new IteratorDecorator(decorated().iterator()); } /** @@ -280,29 +305,4 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> { return (Collection<C>) index.get(key); } - /** - * Iterator that keeps the index in sync when {@code remove()} is used. - */ - private final class IndexedCollectionIterator extends AbstractIteratorDecorator<C> { - - private C lastReturned; - - private IndexedCollectionIterator(final Iterator<C> iterator) { - super(iterator); - } - - @Override - public C next() { - lastReturned = super.next(); - return lastReturned; - } - - @Override - public void remove() { - super.remove(); - removeFromIndex(lastReturned); - lastReturned = null; - } - } - }
