I would like to know if this use of StringBuffer does the same thing as my previous code, because SonarQube asks me not to use +=
for appending strings.
My previous code :
String sign = "";
if (value < 0) {
sign.append("-");
}
My new code with StringBuffer :
StringBuffer sign = new StringBuffer();
sign.append("");
if (value < 0) {
sign.append("-");
}
Is this better this way ?
Thanks for your advices.