empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franci...@apache.org
Subject svn commit: r826525 - in /incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire: db/DBQuery.java xml/XMLUtil.java
Date Sun, 18 Oct 2009 20:58:50 GMT
Author: francisdb
Date: Sun Oct 18 20:58:49 2009
New Revision: 826525

URL: http://svn.apache.org/viewvc?rev=826525&view=rev
Log:
more efficient java 5 way of iterating through maps

Modified:
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBQuery.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/xml/XMLUtil.java

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBQuery.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBQuery.java?rev=826525&r1=826524&r2=826525&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBQuery.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBQuery.java Sun
Oct 18 20:58:49 2009
@@ -20,8 +20,8 @@
 
 import java.sql.Connection;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.empire.commons.Errors;
@@ -413,13 +413,14 @@
         }
         // the commands
         Object[] keys = (Object[]) rec.getRowSetData();
-        Iterator<DBRowSet> tables = updCmds.keySet().iterator();
-        while (tables.hasNext())
+        DBRowSet table;
+        DBCommand upd;
+        for(Entry<DBRowSet,DBCommand> entry:updCmds.entrySet())
         {
             int i = 0;
             // Iterate through options
-            DBRowSet table = tables.next();
-            DBCommand upd = updCmds.get(table);
+            table = entry.getKey();
+            upd = entry.getValue();
             // Is there something to update
             if (upd.set == null)
                 continue; // nothing to do for this table!

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/xml/XMLUtil.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/xml/XMLUtil.java?rev=826525&r1=826524&r2=826525&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/xml/XMLUtil.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/xml/XMLUtil.java Sun
Oct 18 20:58:49 2009
@@ -18,8 +18,8 @@
  */
 package org.apache.empire.xml;
 
-import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -139,12 +139,9 @@
         if (root == null)
             return false;
         // Add Namespace attributes
-        Iterator<String> i = nsMap.keySet().iterator();
-        while (i.hasNext())
+        for(Entry<String, String> entry:nsMap.entrySet())
         {
-            String key = i.next();
-            String val = nsMap.get(key);
-            root.setAttribute("xmlns:" + key, val);
+            root.setAttribute("xmlns:" + entry.getKey(), entry.getValue());
         }
         return true;
     }



Mime
View raw message