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 0341c3af59be12f525138e21e5fe2ee02c5baeb3
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Jul 16 13:56:30 2022 -0400

    Use forEach()
---
 .../java/org/apache/commons/configuration2/tree/TreeData.java     | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/configuration2/tree/TreeData.java 
b/src/main/java/org/apache/commons/configuration2/tree/TreeData.java
index 3a95075a..31ba3e06 100644
--- a/src/main/java/org/apache/commons/configuration2/tree/TreeData.java
+++ b/src/main/java/org/apache/commons/configuration2/tree/TreeData.java
@@ -19,6 +19,8 @@ package org.apache.commons.configuration2.tree;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
 
 /**
  * An internally used helper class for storing information about the managed 
node structure. An instance of this class
@@ -198,10 +200,6 @@ class TreeData extends AbstractImmutableNodeHandler 
implements ReferenceNodeHand
      * @return the inverse replacement mapping
      */
     private Map<ImmutableNode, ImmutableNode> createInverseMapping(final 
Map<ImmutableNode, ImmutableNode> replacements) {
-        final Map<ImmutableNode, ImmutableNode> inverseMapping = new 
HashMap<>();
-        for (final Map.Entry<ImmutableNode, ImmutableNode> e : 
replacements.entrySet()) {
-            inverseMapping.put(e.getValue(), e.getKey());
-        }
-        return inverseMapping;
+        return 
replacements.entrySet().stream().collect(Collectors.toMap(Entry::getValue, 
Entry::getKey));
     }
 }

Reply via email to