CharSequence.subSequence optimizations

Pavel Rappo pavel.rappo at oracle.com
Thu Oct 29 10:36:48 UTC 2015


> On 29 Oct 2015, at 00:48, Aleksey Shipilev <aleksey.shipilev at oracle.com> wrote:
> 
> Doesn't that break when CharSequence implementation is mutable?
> E.g. with StringBuilder, you cannot return "this" when "end ==
> StringBuilder.length()" at the time of .subSequence() call.

True. This trick cannot be used in cases where CharSequence is able to change
its length. (As far as I understand, possible changes in contents are ok.)

Thanks.






More information about the core-libs-dev mailing list