summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2013-09-04 15:55:40 -0700
committerHarvey Harrison <[email protected]>2013-09-04 15:55:40 -0700
commit2ebb8363effaa205972ba7f056aa6435a7fa8d62 (patch)
treec8d129ad21265c3144b0ed2a7692ff9c34fe259e
parentc47bac817d39fda74f757da79f781190fe3ca581 (diff)
gluegen: loop over entries in HashMap directly rather than looping over keys
This saves repeated lookups of the value mapped to each key by just looping over the entries directly. Also remove the URIException clause as this method never can throw that exception. Signed-off-by: Harvey Harrison <[email protected]>
-rw-r--r--src/java/com/jogamp/common/net/URIQueryProps.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/java/com/jogamp/common/net/URIQueryProps.java b/src/java/com/jogamp/common/net/URIQueryProps.java
index 543fb10..fd91b9b 100644
--- a/src/java/com/jogamp/common/net/URIQueryProps.java
+++ b/src/java/com/jogamp/common/net/URIQueryProps.java
@@ -32,6 +32,7 @@ import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
/**
* Helper class to process URI's query, handled as properties.
@@ -59,7 +60,7 @@ public class URIQueryProps {
public final Map<String, String> getProperties() { return properties; }
public final char getQuerySeparator() { return query_separator.charAt(0); }
- public final String appendQuery(String baseQuery) throws URISyntaxException {
+ public final String appendQuery(String baseQuery) {
boolean needsSep = false;
final StringBuilder sb = new StringBuilder();
if ( null != baseQuery ) {
@@ -71,16 +72,15 @@ public class URIQueryProps {
needsSep = true;
}
}
- Iterator<String> propKeys = properties.keySet().iterator();
- while(propKeys.hasNext()) {
+ Iterator<Entry<String, String>> entries = properties.entrySet().iterator();
+ while(entries.hasNext()) {
if(needsSep) {
sb.append(query_separator);
}
- final String key = propKeys.next();
- final String val = properties.get(key);
- sb.append(key);
- if( EMPTY != val ) {
- sb.append(ASSIG).append(properties.get(key));
+ final Entry<String, String> entry = entries.next();
+ sb.append(entry.getKey());
+ if( EMPTY != entry.getValue() ) {
+ sb.append(ASSIG).append(entry.getValue());
}
needsSep = true;
}