This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git


The following commit(s) were added to refs/heads/master by this push:
     new 84cfe34d8 Use forEach()
84cfe34d8 is described below

commit 84cfe34d807f3b51d9b491e7d0f06411506935c9
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Dec 9 12:25:03 2024 -0500

    Use forEach()
---
 .../org/apache/commons/collections4/map/AbstractReferenceMap.java     | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java 
b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
index 216c76202..46f713509 100644
--- 
a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
+++ 
b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
@@ -559,9 +559,7 @@ public abstract class AbstractReferenceMap<K, V> extends 
AbstractHashedMap<K, V>
         public <T> T[] toArray(final T[] arr) {
             // special implementation to handle disappearing values
             final List<V> list = new ArrayList<>(size());
-            for (final V value : this) {
-                list.add(value);
-            }
+            forEach(list::add);
             return list.toArray(arr);
         }
     }

Reply via email to