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/15 03:24:23 UTC
svn commit: r704758 - /xerces/java/trunk/samples/ui/TreeView.java
Author: mrglavas
Date: Tue Oct 14 18:24:22 2008
New Revision: 704758
URL: http://svn.apache.org/viewvc?rev=704758&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/samples/ui/TreeView.java
Modified: xerces/java/trunk/samples/ui/TreeView.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/samples/ui/TreeView.java?rev=704758&r1=704757&r2=704758&view=diff
==============================================================================
--- xerces/java/trunk/samples/ui/TreeView.java (original)
+++ xerces/java/trunk/samples/ui/TreeView.java Tue Oct 14 18:24:22 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: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org