# HG changeset patch # User Sascha L. Teichmann # Date 1314107960 0 # Node ID 68163c3ca407c15ddee32730287b69ef899e99c5 # Parent 73b211b559e2845cff6c137f4ede886fa0caad8a Directly iterate over the entry set of the map. http-client/trunk@2536 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 73b211b559e2 -r 68163c3ca407 ChangeLog --- a/ChangeLog Tue Aug 23 13:49:16 2011 +0000 +++ b/ChangeLog Tue Aug 23 13:59:20 2011 +0000 @@ -1,3 +1,9 @@ +2011-08-23 Sascha L. Teichmann + + * src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java + (createFeedDocument): Directly iterate over the entry set of the map. Do not + use the more expensive 'for all key in keys: value = get(key)' + 2011-08-23 Sascha L. Teichmann * src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java: diff -r 73b211b559e2 -r 68163c3ca407 src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java --- a/src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java Tue Aug 23 13:49:16 2011 +0000 +++ b/src/main/java/de/intevation/artifacts/httpclient/utils/ArtifactProtocolUtils.java Tue Aug 23 13:59:20 2011 +0000 @@ -7,9 +7,7 @@ */ package de.intevation.artifacts.httpclient.utils; -import java.util.Iterator; import java.util.Map; -import java.util.Set; import javax.xml.xpath.XPathConstants; @@ -43,7 +41,7 @@ String uri = ArtifactNamespaceContext.NAMESPACE_URI; - for (int idx = 0, N = elements.getLength(); idx < N; idx++) { + for (int idx = 0; idx < facs.length; idx++) { Element factory = (Element)elements.item(idx); String desc = factory.getAttributeNS(uri, "description"); String name = factory.getAttributeNS(uri, "name"); @@ -140,11 +138,11 @@ Element action = createArtifactAction(creator, artifact, "feed"); Element data = creator.create("data"); - Set keys = attr.keySet(); - Iterator iter = keys.iterator(); - while (iter.hasNext()) { - String key = (String) iter.next(); - Object values = attr.get(key); + for (Map.Entry entry: + ((Map)attr).entrySet()) { + + String key = entry.getKey(); + Object values = entry.getValue(); if (values instanceof Object[]) { appendInputNodes(creator, data, key, (Object[]) values); @@ -152,7 +150,6 @@ else { appendInputNodes(creator, data, key, values); } - } action.appendChild(data);