Given the 2 toString()
implementations below, which is prefered
public String toString(){
return "{a:"+ a + ", b:" + b + ", c: " + c +"}";
}
or
public String toString(){
StringBuilder sb = new StringBuilder(100);
return sb.append("{a:").append(a)
.append(", b:").append(b)
.append(", c:").append(c)
.append("}")
.toString();
}
More importantly given we have only 3 properties it might not make a difference, but at what point do you switch from concat to builder?