You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2008/10/14 15:32:56 UTC
svn commit: r704534 -
/xerces/java/trunk/src/org/apache/xerces/dom/CoreDocumentImpl.java
Author: mrglavas
Date: Tue Oct 14 06:32:55 2008
New Revision: 704534
URL: http://svn.apache.org/viewvc?rev=704534&view=rev
Log:
Minor performance improvement. Iterate over the entries in the map instead
of the keys. This avoids a redundant table lookup for each value.
Modified:
xerces/java/trunk/src/org/apache/xerces/dom/CoreDocumentImpl.java
Modified: xerces/java/trunk/src/org/apache/xerces/dom/CoreDocumentImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/dom/CoreDocumentImpl.java?rev=704534&r1=704533&r2=704534&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/CoreDocumentImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/CoreDocumentImpl.java Tue Oct 14 06:32:55 2008
@@ -24,6 +24,7 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.Map;
import java.util.WeakHashMap;
@@ -337,11 +338,12 @@
if (identifiers != null) {
// Build a reverse mapping from element to identifier.
reversedIdentifiers = new HashMap();
- Enumeration elementIds = identifiers.keys();
- while (elementIds.hasMoreElements()) {
- Object elementId = elementIds.nextElement();
- reversedIdentifiers.put(identifiers.get(elementId),
- elementId);
+ Iterator entries = identifiers.entrySet().iterator();
+ while (entries.hasNext()) {
+ Map.Entry entry = (Map.Entry) entries.next();
+ Object elementId = entry.getKey();
+ Object elementNode = entry.getValue();
+ reversedIdentifiers.put(elementNode, elementId);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org