Refactor: Use StringBuilder instead of repeated string concatenation.

master
Bilbo 2018-11-04 00:21:11 +01:00 committed by Melvin Zhang
parent ce02d4afbb
commit b31f953e02
1 changed files with 5 additions and 4 deletions

View File

@ -118,11 +118,12 @@ class DuelPlayerDeckPanel extends TexturedPanel implements IThemeStyle {
}
private String getVerboseColors(final String colorCodes) {
String colors = "";
for (char ch: colorCodes.toCharArray()) {
colors += MagicColor.getColor(ch).getDisplayName() + ", ";
StringBuilder colors = new StringBuilder();
for (char ch : colorCodes.toCharArray()) {
colors.append(MagicColor.getColor(ch).getDisplayName()).append(", ");
}
return colors.trim().substring(0, colors.trim().length() - 1);
String trimmed = colors.toString().trim();
return trimmed.substring(0, trimmed.length() - 1);
}
private MouseAdapter getMouseAdapter() {