You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/10/11 11:52:23 UTC

camel git commit: Replace the keySet iterator with an entrySet iterator.

Repository: camel
Updated Branches:
  refs/heads/master 188afc579 -> fdb0d18a6


Replace the keySet iterator with an entrySet iterator.

The current source code accesses the value of a Map entry of methodMap, using a key that is retrieved from a keySet iterator.
It is more efficient to use an iterator on the entrySet of the methodMap, to avoid the Map.get(key) lookup.
http://findbugs.sourceforge.net/bugDescriptions.html#WMI_WRONG_MAP_ITERATOR


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fdb0d18a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fdb0d18a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fdb0d18a

Branch: refs/heads/master
Commit: fdb0d18a680ac631be1865df76e0408f21c9723b
Parents: 188afc5
Author: Kui LIU <br...@gmail.com>
Authored: Wed Oct 11 11:15:23 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Oct 11 13:50:43 2017 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/component/bean/BeanInfo.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fdb0d18a/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java b/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
index 48eb177..1628793 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
@@ -401,9 +401,10 @@ public class BeanInfo {
         MethodInfo answer = methodMap.get(method);
         if (answer == null) {
             // maybe the method overrides, and the method map keeps info of the source override we can use
-            for (Method source : methodMap.keySet()) {
+            for (Map.Entry<Method, MethodInfo> methodEntry : methodMap.entrySet()) {
+                Method source = methodEntry.getKey();
                 if (ObjectHelper.isOverridingMethod(getType(), source, method, false)) {
-                    answer = methodMap.get(source);
+                    answer = methodEntry.getValue();
                     break;
                 }
             }