Return-Path: Delivered-To: apmail-incubator-empire-db-commits-archive@minotaur.apache.org Received: (qmail 12452 invoked from network); 18 Oct 2009 20:59:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Oct 2009 20:59:14 -0000 Received: (qmail 83470 invoked by uid 500); 18 Oct 2009 20:59:14 -0000 Delivered-To: apmail-incubator-empire-db-commits-archive@incubator.apache.org Received: (qmail 83450 invoked by uid 500); 18 Oct 2009 20:59:14 -0000 Mailing-List: contact empire-db-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: empire-db-dev@incubator.apache.org Delivered-To: mailing list empire-db-commits@incubator.apache.org Received: (qmail 83440 invoked by uid 99); 18 Oct 2009 20:59:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Oct 2009 20:59:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Oct 2009 20:59:11 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6AC5123888EA; Sun, 18 Oct 2009 20:58:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: empire-db-commits@incubator.apache.org From: francisdb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091018205850.6AC5123888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 tables = updCmds.keySet().iterator(); - while (tables.hasNext()) + DBRowSet table; + DBCommand upd; + for(Entry 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 i = nsMap.keySet().iterator(); - while (i.hasNext()) + for(Entry 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; }