You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/07/16 16:16:27 UTC

[commons-configuration] 05/10: Use forEach()

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-configuration.git

commit 0d027e873adcf23c7a5dc570b0367dafef8e1be1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 16 12:15:26 2022 -0400

    Use forEach()
---
 .../java/org/apache/commons/configuration2/beanutils/BeanHelper.java  | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/configuration2/beanutils/BeanHelper.java b/src/main/java/org/apache/commons/configuration2/beanutils/BeanHelper.java
index 84724f55..9341e215 100644
--- a/src/main/java/org/apache/commons/configuration2/beanutils/BeanHelper.java
+++ b/src/main/java/org/apache/commons/configuration2/beanutils/BeanHelper.java
@@ -185,9 +185,7 @@ public final class BeanHelper {
                     final Class<?> defaultClass = getDefaultClass(bean, propName);
                     if (prop instanceof Collection) {
                         final Collection<Object> beanCollection = createPropertyCollection(propName, defaultClass);
-                        for (final Object elemDef : (Collection<?>) prop) {
-                            beanCollection.add(createBean((BeanDeclaration) elemDef));
-                        }
+                        ((Collection<BeanDeclaration>) prop).forEach(elemDef -> beanCollection.add(createBean(elemDef)));
                         initProperty(bean, propName, beanCollection);
                     } else {
                         initProperty(bean, propName, createBean((BeanDeclaration) prop, defaultClass));