AW: uses CharSequence.toString()

ecki at ecki at
Fri Jul 29 14:12:21 UTC 2016


Have to agree with Fabian handling CharSequences (and special case StringBuilder) is pretty weak, in CharBuffer.append(CharSequence) you see the same toString. I would expect it to do:
- Instamceof String -> use it
- Instance of StringBuilder -> extract char[] and iterate
- Instance of CharBuffer -> handle
- Otherwise: Loop over charAt

(the otherwise might be a tradeof between allocation and (not)inlined bounds checks) 

Alternative would be a CharSequence.fillInto(char[])

BTW wouldn't it be create if char[] implements CharSequence?

>From Win 10 Mobile

Von: Fabian Lange

More information about the core-libs-dev mailing list