diff options
author | Andrey Turbanov <turbanoff@gmail.com> | 2021-12-18 15:53:24 +0300 |
---|---|---|
committer | Andrey Turbanov <turbanoff@gmail.com> | 2021-12-18 15:53:24 +0300 |
commit | be522b7e8a591ef54f71d574dd5c76799a2b5136 (patch) | |
tree | 09bbb769226a741706c4e68a794b00a49de4172b /ajde/src | |
parent | 4021ffcbfe320a1b91bb2bcee7a112f7122ef82d (diff) | |
download | aspectj-be522b7e8a591ef54f71d574dd5c76799a2b5136.tar.gz aspectj-be522b7e8a591ef54f71d574dd5c76799a2b5136.zip |
Use StringBuilder/StringJoiner for concatenation String's in loop
Diffstat (limited to 'ajde/src')
-rw-r--r-- | ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java | 12 | ||||
-rw-r--r-- | ajde/src/main/java/org/aspectj/ajde/ui/internal/UserPreferencesStore.java | 6 |
2 files changed, 9 insertions, 9 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 5b83060b8..fd2940c32 100644 --- a/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java +++ b/ajde/src/main/java/org/aspectj/ajde/internal/LstBuildConfigFileUpdater.java @@ -117,11 +117,11 @@ class LstBuildConfigFileUpdater { public void writeConfigFile(String filePath, List<BuildConfigNode> files, List<BuildConfigNode> importedNodes) { // Set contentsSet = new TreeSet(fileContents); - String fileContentsString = ""; + StringBuilder fileContentsString = new StringBuilder(); // List filesToWrite = null; Set<String> includedFiles = new HashSet<>(); for (BuildConfigNode node : importedNodes) { - fileContentsString += '@' + node.getResourcePath() + "\n"; + fileContentsString.append('@').append(node.getResourcePath()).append("\n"); String parentPath = new File(filePath).getParent(); String importedFilePath = parentPath + File.separator + node.getResourcePath(); includedFiles.addAll(getIncludedFiles(importedFilePath, parentPath)); @@ -129,15 +129,15 @@ class LstBuildConfigFileUpdater { for (BuildConfigNode node : files) { if (node.getName().endsWith(".lst") && !node.getResourcePath().startsWith("..")) { - fileContentsString += '@'; - fileContentsString += node.getResourcePath() + "\n"; + fileContentsString.append('@'); + fileContentsString.append(node.getResourcePath()).append("\n"); } else { if (!includedFiles.contains(node.getResourcePath())) { - fileContentsString += node.getResourcePath() + "\n"; + fileContentsString.append(node.getResourcePath()).append("\n"); } } } - writeFile(fileContentsString, filePath); + writeFile(fileContentsString.toString(), filePath); } private List<String> getIncludedFiles(String path, String rootPath) { diff --git a/ajde/src/main/java/org/aspectj/ajde/ui/internal/UserPreferencesStore.java b/ajde/src/main/java/org/aspectj/ajde/ui/internal/UserPreferencesStore.java index b8dc93332..d774dadee 100644 --- a/ajde/src/main/java/org/aspectj/ajde/ui/internal/UserPreferencesStore.java +++ b/ajde/src/main/java/org/aspectj/ajde/ui/internal/UserPreferencesStore.java @@ -74,11 +74,11 @@ public class UserPreferencesStore implements UserPreferencesAdapter { @Override public void setProjectMultivalPreference(String name, List values) { - String valuesString = ""; + StringBuilder valuesString = new StringBuilder(); for (Object value : values) { - valuesString += (String) value + ';'; + valuesString.append((String)value).append(';'); } - properties.setProperty(name, valuesString); + properties.setProperty(name, valuesString.toString()); saveProperties(); } |