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 f24800fa4565482581053a3d7b767ff84ee44a82 Author: Gary Gregory <[email protected]> AuthorDate: Wed Jun 17 20:33:10 2026 +0000 IndexedCollection: Use stream API internally. Javadoc --- .../collections4/collection/IndexedCollection.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 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 27eb6451d..c534703a3 100644 --- a/src/main/java/org/apache/commons/collections4/collection/IndexedCollection.java +++ b/src/main/java/org/apache/commons/collections4/collection/IndexedCollection.java @@ -90,7 +90,7 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> { private final boolean uniqueIndex; /** - * Create a {@link IndexedCollection}. + * Creates a {@link IndexedCollection}. * * @param coll decorated {@link Collection}. * @param keyTransformer {@link Transformer} for generating index keys. @@ -154,6 +154,7 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> { * {@inheritDoc} * <p> * Note: uses the index for fast lookup. + * </p> */ @SuppressWarnings("unchecked") @Override @@ -165,15 +166,11 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> { * {@inheritDoc} * <p> * Note: uses the index for fast lookup. + * </p> */ @Override public boolean containsAll(final Collection<?> coll) { - for (final Object o : coll) { - if (!contains(o)) { - return false; - } - } - return true; + return coll.stream().allMatch(this::contains); } /** @@ -199,9 +196,7 @@ public class IndexedCollection<K, C> extends AbstractCollectionDecorator<C> { */ public void reindex() { index.clear(); - for (final C c : decorated()) { - addToIndex(c); - } + decorated().forEach(this::addToIndex); } @SuppressWarnings("unchecked")
