aboutsummaryrefslogtreecommitdiffstats
path: root/ajde
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:09:01 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:09:01 +0200
commita508fd5315c6330f2057c219aebc35b15d0ea497 (patch)
treec0ec3cef4e3411f22e5124ae36eba542a35a495a /ajde
parent72194b7982ddfa8e9864d0a9934905bb76b90f33 (diff)
downloadaspectj-a508fd5315c6330f2057c219aebc35b15d0ea497.tar.gz
aspectj-a508fd5315c6330f2057c219aebc35b15d0ea497.zip
'while' loop replaceable with enhanced 'for' loop
Reports while loops which iterate over collections, and can be replaced with an enhanced for loop (i.e. foreach iteration syntax). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'ajde')
-rw-r--r--ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java b/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java
index f3e2154cd..4e59e5d74 100644
--- a/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java
+++ b/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java
@@ -81,9 +81,8 @@ class LstBuildConfigFileUpdater {
}
public boolean exists(String entry, String configFile, String rootPath) {
- Iterator it = readConfigFile(configFile).iterator();
- while (it.hasNext()) {
- if ((entry).equals(rootPath + "/" + (String) it.next())) {
+ for (String s : readConfigFile(configFile)) {
+ if ((entry).equals(rootPath + "/" + s)) {
return true;
}
}
@@ -188,9 +187,8 @@ class LstBuildConfigFileUpdater {
public void writeConfigFile(String filePath, List<String> fileContents) {
Set<String> contentsSet = new TreeSet<>(fileContents);
StringBuffer fileContentsSB = new StringBuffer();
- Iterator<String> it = contentsSet.iterator();
- while (it.hasNext()) {
- fileContentsSB.append(it.next().toString());
+ for (String s : contentsSet) {
+ fileContentsSB.append(s.toString());
fileContentsSB.append("\n");
}
writeFile(fileContentsSB.toString(), filePath);