Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.3.1
Description
StrBuilder.append(CharSequence) and StrBuilder.append(CharSequence, int, int) can be optimized for the case when CharBuffer is passed. Current implementation calls toString() method that allocates a new String. In case when CharBuffer.hasArray() returns true the buffer-backing char array can be accessed directly to copy chars from it.
Also an instanceOf StrBuilder check can be added to StrBuilder.append(CharSequence) and StrBuilder.append(CharSequence, int, int) to avoid toString() in that case too (StrBuilder can be passed as CharSequence in some cases).