pmd:ConsecutiveAppendsShouldReuse - Consecutive Appends Should Reuse

This commit is contained in:
Mohammed Ezzat
2016-01-26 19:55:32 +02:00
parent 1a55f3a420
commit d00bfae5ee
3 changed files with 22 additions and 26 deletions

View File

@ -69,14 +69,14 @@ public class Character {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("This is a ");
sb.append(fighterClass != null ? fighterClass : wizardClass);
sb.append(" named ");
sb.append(name);
sb.append(" armed with a ");
sb.append(weapon != null ? weapon : spell != null ? spell : "with nothing");
sb.append(abilities != null ? (" and wielding " + abilities + " abilities") : "");
sb.append(".");
sb.append("This is a ")
.append(fighterClass != null ? fighterClass : wizardClass)
.append(" named ")
.append(name)
.append(" armed with a ")
.append(weapon != null ? weapon : spell != null ? spell : "with nothing")
.append(abilities != null ? (" and wielding " + abilities + " abilities") : "")
.append(".");
return sb.toString();
}
}