I have read some articles about the pros and cons of String and StringBuilder in the Java Programming language. In one of the articles, the author
String
StringBuilder
StringBuilder inside a method would be safe.
public void addProperty(String name, String value) { private StringBuilder sb = new StringBuilder("1=2"); if (value != null && value.length() > 0) { if (sb.length() > 0) { sb.append(','); } sb.append(name).append('=').append(value); } }