String.contains(CharSequence) calls toString on argument

Tomasz Kowalczewski tomasz.kowalczewski at gmail.com
Fri Mar 20 09:34:24 UTC 2015


Hello!

Current implementation of String.contains that accepts CharSequence calls
toString on it and passes resulting string to indexOf(String). This IMO
defeats the purpose of using CharSequences (that is to have a mutable
character buffer and not allocate unnecessary objects).

Is changing this a desirable development? It seems pretty straightforward
to port indexOf(String) to use CharSequence.

If all you need is patch then I can work on it (I have signed OCA) just
wanted to make sure it is not a futile work.

-- 
Regards,
Tomasz Kowalczewski



More information about the core-libs-dev mailing list