[PATCH] AbstractStringBuilder.append(<StringBuilder>)

Isaac Levy isaac.r.levy at gmail.com
Wed Jul 18 14:49:50 UTC 2018


I think adding a dedicated method would help clarify and encourage
performant code.  For example, I sped up the snippet below after
seeing that StringBuilder.append(<CharSequence>) has a fast path
when the arg is another StringBuilder, which isn't clear from the javadoc.


public class ScalaSB implements java.lang.CharSequence {
  final StringBuilder sb;
  ...

  public append(ScalaSB other) {
-     sb.append(other);
+    sb.append(other.sb);
  }
}


More information about the core-libs-dev mailing list