groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] 04/06: Trivial refactoring: Can be replaced with single 'Map.replaceAll' method call
Date Sun, 03 Nov 2019 13:39:10 GMT
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 746c05e151764413b180087fc6a4db593c0685c8
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Sun Nov 3 21:32:06 2019 +0800

    Trivial refactoring: Can be replaced with single 'Map.replaceAll' method call
---
 .../codehaus/groovy/transform/stc/AbstractExtensionMethodCache.java   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/transform/stc/AbstractExtensionMethodCache.java
b/src/main/java/org/codehaus/groovy/transform/stc/AbstractExtensionMethodCache.java
index bfb5c04..d65d9d4 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/AbstractExtensionMethodCache.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/AbstractExtensionMethodCache.java
@@ -100,9 +100,7 @@ public abstract class AbstractExtensionMethodCache {
     }
 
     private Map<String, List<MethodNode>> makeMethodsUnmodifiable(Map<String,
List<MethodNode>> methods) {
-        for (Map.Entry<String, List<MethodNode>> entry : methods.entrySet())
{
-            methods.put(entry.getKey(), Collections.unmodifiableList(entry.getValue()));
-        }
+        methods.replaceAll((k, v) -> Collections.unmodifiableList(v));
 
         return Collections.unmodifiableMap(methods);
     }


Mime
View raw message