From be522b7e8a591ef54f71d574dd5c76799a2b5136 Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Sat, 18 Dec 2021 15:53:24 +0300 Subject: Use StringBuilder/StringJoiner for concatenation String's in loop --- .../src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'taskdefs') diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java index c26c13309..e58db40f2 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/Ajdoc.java @@ -20,9 +20,9 @@ import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.StringJoiner; import java.util.StringTokenizer; import java.util.Vector; @@ -636,14 +636,13 @@ public class Ajdoc extends MatchingTask { } for (String title: groupMap.keySet()) { List packages = groupMap.get(title); - String pkgstr = ""; - for (Iterator j = packages.iterator(); j.hasNext();) { - pkgstr += j.next(); - if (j.hasNext()) pkgstr += ","; + StringJoiner pkgstr = new StringJoiner(","); + for (String aPackage : packages) { + pkgstr.add(aPackage); } cmd.createArgument().setValue("-group"); cmd.createArgument().setValue(title); - cmd.createArgument().setValue(pkgstr); + cmd.createArgument().setValue(pkgstr.toString()); } if (argfiles != null) { for (File file : argfiles) { -- cgit v1.2.3