Question on String#indexOf(String)

Jim Andreou jim.andreou at gmail.com
Tue Apr 28 10:50:14 UTC 2009


Hi,
I wonder why String#indexOf(String) is implemented as it is. Apparently,
when a character mismatch with the searched pattern is found, the pattern is
only shifted by one character, but there are faster algorithms, for example
see
http://www.cs.utexas.edu/users/moore/best-ideas/string-searching/index.html.
Was anything smarter tried out but had significant disadvantages for general
use? What advantages does the current implementation have? It looks very
pessimistic.

Regards,
Dimitris Andreou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20090428/9535830f/attachment.html>


More information about the core-libs-dev mailing list