Author: mrglavas
Date: Tue Oct 14 18:24:40 2008
New Revision: 704759
URL: http://svn.apache.org/viewvc?rev=704759&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/branches/xml-schema-1.1-dev/samples/ui/TreeView.java
Modified: xerces/java/branches/xml-schema-1.1-dev/samples/ui/TreeView.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/ui/TreeView.java?rev=704759&r1=704758&r2=704759&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/samples/ui/TreeView.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/samples/ui/TreeView.java Tue Oct 14
18:24:40 2008
@@ -35,9 +35,10 @@
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Enumeration;
import java.util.EventObject;
import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
import java.util.Vector;
import javax.swing.BorderFactory;
@@ -311,11 +312,13 @@
messageText.append("Please click on red Tree View items for
details.\n");
/***/
Hashtable errors = ef.getErrorNodes();
- Enumeration keys = errors.keys();
- while (keys.hasMoreElements()) {
- Node node = (Node)keys.nextElement();
+ Iterator entries = errors.entrySet().iterator();
+ while (entries.hasNext()) {
+ Map.Entry entry = (Map.Entry) entries.next();
+ Node node = (Node) entry.getKey();
+ ParseError parseError = (ParseError) entry.getValue();
messageText.append("node="+node.getNodeName()
- +", error="+((ParseError)errors.get(node)).getMsg()+"\n");
+ +", error="+parseError.getMsg()+"\n");
}
}
if (DEBUG) System.out.println("END refreshUI:"+filename);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]