String foo = "foo"; foo += "bar";
String foo = "foo"; foo = new StringBuilder(foo).append("bar");
String foo = "foo"; foo += "bar"; foo += "qux";
String foo = "foo"; foo = new StringBuilder(foo).append("bar"); foo = new StringBuilder(foo).append("qux");
The actual code was more complicated (and bigger strings), but the issue is that each statement is its own StringBuilder.
That prompted me to explore it and I looked at the byte code invocations at http://shagie.net/2014/08/17/what-goes-on-behind-the-scenes-...
The actual code was more complicated (and bigger strings), but the issue is that each statement is its own StringBuilder.
That prompted me to explore it and I looked at the byte code invocations at http://shagie.net/2014/08/17/what-goes-on-behind-the-scenes-...