Code cleanup - move old iterator/while loops to for loops

This commit is contained in:
rbygrave committed 2014-07-19 19:10:13 +12:00
1 parent 0c4fc4eea3
commit 63e9f603ec
25 files changed
+360 -524

No files matched your search

@@ -2,9 +2,7 @@ package com.avaje.ebeaninternal.server.query;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
@@ -87,14 +85,12 @@ public class SqlTreeAlias {
*/
public void buildAlias() {
Iterator<String> i = joinProps.iterator();
while (i.hasNext()) {
calcAlias(i.next());
for (String joinProp : joinProps) {
calcAlias(joinProp);
}
i = manyWhereJoinProps.iterator();
while (i.hasNext()) {
calcAliasManyWhere(i.next());
for (String joinProp : manyWhereJoinProps) {
calcAliasManyWhere(joinProp);
}
mapEmbeddedPropertyAlias();
@@ -192,9 +188,7 @@ public class SqlTreeAlias {
*/
private String parseAliasMap(String clause, HashMap<String, String> parseAliasMap) {
Iterator<Entry<String, String>> i = parseAliasMap.entrySet().iterator();
while (i.hasNext()) {
Map.Entry<String, String> e = i.next();
for (Map.Entry<String, String> e : parseAliasMap.entrySet()) {
String k = "${" + e.getKey() + "}";
clause = clause.replace(k, e.getValue() + ".");
}
@@ -5,7 +5,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -304,11 +303,8 @@ public class SqlTreeBuilder {
} else {
// add extra joins required to support predicates
// and/or order by clause
Iterator<SqlTreeNodeExtraJoin> it = extraJoins.iterator();
while (it.hasNext()) {
SqlTreeNodeExtraJoin extraJoin = it.next();
for (SqlTreeNodeExtraJoin extraJoin: extraJoins) {
myList.add(extraJoin);
if (extraJoin.isManyJoin()) {
// as we are now going to join to the many then we need
// to add the distinct to the sql query to stop duplicate
@@ -420,9 +416,7 @@ public class SqlTreeBuilder {
// Also note that this can include transient properties.
// This makes sense for transient properties used to
// hold sum() count() type values (with SqlSelect)
Iterator<String> it = queryProps.getSelectProperties();
while (it.hasNext()) {
String propName = it.next();
for (String propName : queryProps.getSelectProperties()) {
if (propName.length() > 0) {
addProperty(selectProps, desc, queryProps, propName);
}