Add getChars to CharSequence

Martin Buchholz martinrb at
Thu Apr 11 00:40:52 UTC 2013

I've often wished that CharSequence had getChars methods, as many of the
concrete implementations already do.
In jdk8 with default methods, this is possible!
This will make some of the String code a little nicer and more efficient.

Here's a preliminary patch in this direction, that overlaps with some of
the work done in

6206780: (str) Forwarding append methods in String{Buffer,Builder} are
Summary: update StringBuilder & StringBuffer to consistently handle
forwarding to AbstractStringBuilder. Some additional cleanup (removal of
refs to sub-classes from AbstractStringBuilder)

If we have consensus that this is a good idea, I can flesh this out.

More information about the core-libs-dev mailing list