2 ms·
Because I know that every corporate app dev is (NOT) going to write: StringBuilder buf = new StringBuilder( s1); buf.append( s2); String cat = buf.t
by Roboprog 14y ago
Because I know that every corporate app dev is (NOT) going to write:
StringBuilder buf = new StringBuilder( s1);
buf.append( s2);
String cat = buf.toString();
instead of:
String cat = s1 + s1;
in their application code. (although I think that is pretty much what the compiler generates on your behalf, anyway)
The loop is in the benchmark so I don't have to write code dealing with many different string values of differing size manually.