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 6f5fdad793c5eb740376034cc658b30d7e1ec615 Author: Gary Gregory <[email protected]> AuthorDate: Sat Jul 16 14:26:14 2022 -0400 Use forEach() --- .../apache/commons/configuration2/XMLConfiguration.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java b/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java index 1db1a594..ee4417a8 100644 --- a/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java +++ b/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java @@ -943,12 +943,12 @@ public class XMLConfiguration extends BaseHierarchicalConfiguration implements F * @param refHandler the {@code ReferenceNodeHandler} */ public void handleRemovedNodes(final ReferenceNodeHandler refHandler) { - for (final Object ref : refHandler.removedReferences()) { + refHandler.removedReferences().forEach(ref -> { if (ref instanceof Node) { final Node removedElem = (Node) ref; removeReference((Element) elementMapping.get(removedElem)); } - } + }); } /** @@ -1076,11 +1076,11 @@ public class XMLConfiguration extends BaseHierarchicalConfiguration implements F private static void updateAttributes(final ImmutableNode node, final Element elem) { if (node != null && elem != null) { clearAttributes(elem); - for (final Map.Entry<String, Object> e : node.getAttributes().entrySet()) { - if (e.getValue() != null) { - elem.setAttribute(e.getKey(), e.getValue().toString()); + node.getAttributes().forEach((k, v) -> { + if (v != null) { + elem.setAttribute(k, v.toString()); } - } + }); } } @@ -1127,9 +1127,7 @@ public class XMLConfiguration extends BaseHierarchicalConfiguration implements F } // Remove all but the first Text node - for (final Node tn : textNodes) { - elem.removeChild(tn); - } + textNodes.forEach(elem::removeChild); return result; } }
