uses CharSequence.toString()

Pavel Rappo pavel.rappo at
Fri Jul 29 09:43:20 UTC 2016

> On 29 Jul 2016, at 09:23, Fabian Lange <lange.fabian at> wrote:
> This is especially sad because after having mad the String, write()
> will then copy out the chars of the string and then iterate over the
> chars individually.

As far as I can see no one iterates over chars individually. Instead, bulk write
is invoked with the char array from the String [1].

In contrast with, encourages bulk writes,
not single char writes. So the premise is that a concrete subclass provides
efficient bulk write. If this doesn't hold, then one could override 

	Writer append(CharSequence csq)

in this class to behave exactly like you said.

> Something an iteration over chars of the CharSequence could have
> achieved much better.

I'm not sure about this. But you could prove it with a set of benchmarks for
concrete subclasses in the JDK.


More information about the core-libs-dev mailing list