AW: java.io.Writer uses CharSequence.toString()
ecki at zusammenkunft.net
ecki at zusammenkunft.net
Fri Jul 29 14:12:21 UTC 2016
Hello,
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?
Gruss
Bernd
--
http://bernd.eckenfels.net
>From Win 10 Mobile
Von: Fabian Lange
More information about the core-libs-dev
mailing list