aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHk-tang <hktang@ualberta.ca>2020-04-06 08:38:29 -0600
committerGitHub <noreply@github.com>2020-04-06 17:38:29 +0300
commitf6a9a9ad489be81bb7327096b038cc6b63cfa39a (patch)
tree9c64ff6dd082997133de897f0e9dacc5f4d049a9
parenta281d73fc2d00a52e7b0dc3f1da060f80391cfb8 (diff)
downloadvaadin-framework-f6a9a9ad489be81bb7327096b038cc6b63cfa39a.tar.gz
vaadin-framework-f6a9a9ad489be81bb7327096b038cc6b63cfa39a.zip
Change to using StringBuilder (#11941)
Should use a StringBuilder to accumulate strings in a loop, to avoid the performance cost of repeatedly constructing strings.
-rw-r--r--server/src/main/java/com/vaadin/ui/declarative/Design.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/server/src/main/java/com/vaadin/ui/declarative/Design.java b/server/src/main/java/com/vaadin/ui/declarative/Design.java
index 0b78a9cbde..a2c698c6bd 100644
--- a/server/src/main/java/com/vaadin/ui/declarative/Design.java
+++ b/server/src/main/java/com/vaadin/ui/declarative/Design.java
@@ -234,14 +234,14 @@ public class Design implements Serializable {
throw new DesignException("Unknown tag: " + tagName);
}
String[] classNameParts = parts[1].split("-");
- String className = "";
+ StringBuilder className = new StringBuilder();
for (String classNamePart : classNameParts) {
// Split will ignore trailing and multiple dashes but that
// should be
// ok
// <vaadin-button--> will be resolved to <vaadin-button>
// <vaadin--button> will be resolved to <vaadin-button>
- className += SharedUtil.capitalize(classNamePart);
+ className.append(SharedUtil.capitalize(classNamePart));
}
String qualifiedClassName = packageName + "." + className;