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 752aaa433 Use forEach()
752aaa433 is described below
commit 752aaa433bccca1f285d8f5d18bbc64b5a2794e8
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Dec 9 11:10:09 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 ec23f6edf..216c76202 100644
---
a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
+++
b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
@@ -430,9 +430,7 @@ public abstract class AbstractReferenceMap<K, V> extends
AbstractHashedMap<K, V>
public <T> T[] toArray(final T[] arr) {
// special implementation to handle disappearing keys
final List<K> list = new ArrayList<>(size());
- for (final K key : this) {
- list.add(key);
- }
+ forEach(list::add);
return list.toArray(arr);
}
}