commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [1/4] [lang] Fix SonarQube warning: org.apache.commons.lang3.ClassUtils.<static initializer for ClassUtils>() makes inefficient use of keySet iterator instead of entrySet iterator.
Date Tue, 05 May 2015 17:35:07 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master fc73151cf -> 98220ad03


Fix SonarQube warning: org.apache.commons.lang3.ClassUtils.<static initializer for ClassUtils>()
makes inefficient use of keySet iterator instead of entrySet iterator.


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/8d0214a7
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/8d0214a7
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/8d0214a7

Branch: refs/heads/master
Commit: 8d0214a7417addf790713440f10855dc279876fa
Parents: 1cb5573
Author: Benedikt Ritter <britter@apache.org>
Authored: Tue May 5 18:54:53 2015 +0200
Committer: Benedikt Ritter <britter@apache.org>
Committed: Tue May 5 18:58:13 2015 +0200

----------------------------------------------------------------------
 src/main/java/org/apache/commons/lang3/ClassUtils.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8d0214a7/src/main/java/org/apache/commons/lang3/ClassUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java b/src/main/java/org/apache/commons/lang3/ClassUtils.java
index 92ecb15..c56aeab 100644
--- a/src/main/java/org/apache/commons/lang3/ClassUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java
@@ -94,8 +94,9 @@ public class ClassUtils {
      */
     private static final Map<Class<?>, Class<?>> wrapperPrimitiveMap =
new HashMap<Class<?>, Class<?>>();
     static {
-        for (final Class<?> primitiveClass : primitiveWrapperMap.keySet()) {
-            final Class<?> wrapperClass = primitiveWrapperMap.get(primitiveClass);
+        for (final Map.Entry<Class<?>, Class<?>> entry : primitiveWrapperMap.entrySet())
{
+            final Class<?> primitiveClass = entry.getKey();
+            final Class<?> wrapperClass = entry.getValue();
             if (!primitiveClass.equals(wrapperClass)) {
                 wrapperPrimitiveMap.put(wrapperClass, primitiveClass);
             }


Mime
View raw message