geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1396471 - /geronimo/server/branches/3.0/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/AbstractName.java
Date Wed, 10 Oct 2012 04:56:57 GMT
Author: gawor
Date: Wed Oct 10 04:56:57 2012
New Revision: 1396471

URL: http://svn.apache.org/viewvc?rev=1396471&view=rev
Log:
another tiny optimization - avoids creating extra TreeMap

Modified:
    geronimo/server/branches/3.0/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/AbstractName.java

Modified: geronimo/server/branches/3.0/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/AbstractName.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/AbstractName.java?rev=1396471&r1=1396470&r2=1396471&view=diff
==============================================================================
--- geronimo/server/branches/3.0/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/AbstractName.java
(original)
+++ geronimo/server/branches/3.0/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/AbstractName.java
Wed Oct 10 04:56:57 2012
@@ -54,7 +54,7 @@ public class AbstractName implements Ser
 
         this.objectName = Jsr77Naming.createObjectName(name);
 
-        this.uri = createURI(artifact, name);
+        this.uri = createURI(artifact, new TreeMap(name));
     }
 
     public AbstractName(Artifact artifact, Map name, ObjectName objectName) {
@@ -67,7 +67,7 @@ public class AbstractName implements Ser
         this.name = unmodifiableMap(name);
         this.objectName = objectName;
 
-        this.uri = createURI(artifact, name);
+        this.uri = createURI(artifact, new TreeMap(name));
     }
 
     /**
@@ -123,7 +123,7 @@ public class AbstractName implements Ser
         //
         // name map
         //
-        Map<String, String> nameMap = new TreeMap<String, String>();
+        TreeMap<String, String> nameMap = new TreeMap<String, String>();
         List<String> nameParts = split(nameString, ',');
         for (Iterator<String> iterator = nameParts.iterator(); iterator.hasNext();)
{
             String namePart = (String) iterator.next();
@@ -146,7 +146,7 @@ public class AbstractName implements Ser
         //
         // uri
         //
-        this.uri = createURI(artifact, name);
+        this.uri = createURI(artifact, nameMap);
 
         //
         // object name
@@ -154,13 +154,12 @@ public class AbstractName implements Ser
         this.objectName = Jsr77Naming.createObjectName(name);
     }
 
-    private static URI createURI(Artifact artifact, Map name) {
+    private static URI createURI(Artifact artifact, TreeMap<String, String> name) {
         StringBuilder queryString = new StringBuilder();
-        TreeMap treeMap = new TreeMap(name);
-        for (Iterator iterator = treeMap.entrySet().iterator(); iterator.hasNext();) {
-            Map.Entry entry = (Map.Entry) iterator.next();
-            String key = (String) entry.getKey();
-            String value = (String) entry.getValue();
+        for (Iterator<Map.Entry<String, String>> iterator = name.entrySet().iterator();
iterator.hasNext();) {
+            Map.Entry<String, String> entry = iterator.next();
+            String key = entry.getKey();
+            String value = entry.getValue();
             queryString.append(key).append('=').append(value);
             if (iterator.hasNext()) {
                 queryString.append(',');



Mime
View raw message