8058779: Faster implementation of String.replace(CharSequence, CharSequence)

Ivan Gerasimov ivan.gerasimov at oracle.com
Sun May 31 02:19:31 UTC 2015


Hi everyone!

Here's another webrev, in which replace() is implemented with StringBuilder.
On my benchmark it is almost as fast as the version backed with arrays, 
but this variant is much shorter.

Credits to Sherman for combining the general algorithm with the case of 
empty target.

Comments, further suggestions are welcome!

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8058779
WEBREV: http://cr.openjdk.java.net/~igerasim/8058779/04/webrev/

Sincerely yours,
Ivan




More information about the core-libs-dev mailing list