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 57bf6e4144a8bf7c65cbc5453c2e4fd8af0f71f2
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Jun 17 19:41:49 2026 +0000

    CompositeCollection#clear(): Use stream API internally.
---
 .../apache/commons/collections4/collection/CompositeCollection.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/collections4/collection/CompositeCollection.java
 
b/src/main/java/org/apache/commons/collections4/collection/CompositeCollection.java
index 3581e5ceb..69771dc5b 100644
--- 
a/src/main/java/org/apache/commons/collections4/collection/CompositeCollection.java
+++ 
b/src/main/java/org/apache/commons/collections4/collection/CompositeCollection.java
@@ -227,13 +227,11 @@ public class CompositeCollection<E> implements 
Collection<E>, Serializable {
      * This implementation calls {@code clear()} on each collection.
      * </p>
      *
-     * @throws UnsupportedOperationException if clear is unsupported
+     * @throws UnsupportedOperationException if clear is unsupported.
      */
     @Override
     public void clear() {
-        for (final Collection<E> coll : all) {
-            coll.clear();
-        }
+        all.forEach(Collection::clear);
     }
 
     /**

Reply via email to