Skip to content

Commit

Permalink
Replace some StringBuilders with String concatenation
Browse files Browse the repository at this point in the history
`StringBuilder` provides no benefit when building a `String` using just
one concatenation.
  • Loading branch information
liblit committed Nov 16, 2024
1 parent 6909f8e commit affe403
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ public static String deployment2CanonicalTypeString(String dString) {
String baseType = dString.substring(0, arrayIndex);
int dim = (dString.length() - arrayIndex) / 2;
baseType = deployment2CanonicalTypeString(baseType);
StringBuilder result = new StringBuilder("[".repeat(dim));
result.append(baseType);
return result.toString();
return "[".repeat(dim) + baseType;
} else {
if (primitiveClassNames.get(dString) != null) {
return primitiveClassNames.get(dString);
Expand Down Expand Up @@ -102,9 +100,7 @@ public static String deployment2CanonicalDescriptorTypeString(String dString) {
String baseType = dString.substring(0, arrayIndex);
int dim = (dString.length() - arrayIndex) / 2;
baseType = deployment2CanonicalDescriptorTypeString(baseType);
StringBuilder result = new StringBuilder("[".repeat(dim));
result.append(baseType);
return result.toString();
return "[".repeat(dim) + baseType;
} else {
if (primitiveClassNames.get(dString) != null) {
return primitiveClassNames.get(dString);
Expand Down

0 comments on commit affe403

Please sign in to comment.