In src/share/classes/java/lang/String.java, String.toLowerCase(Locale)
(and String.toUpperCase(Locale)) start off with
if (locale.getLanguage().equals("tr")) ...
with some special code for the Turkish locale. Since we are already
doing a dispatch to the locale, why not add toLowerCase(char[]) to
the Locale API and let the locale do the conversion itself. There
could be a default implementation that does the fast loop, but then
the Turkish locale could have an overriding definition that does the
dotted i transformation. Object oriented code! What a concept.
The default implementation could use Character.toLowerCase just like
now. Or the 8859-1 locale (I'm probably mixing types here) could
special case 'A'..'Z' and rest of the ASCII subset not do the shifting
and masking and 3 (count 'em, 3) array subscript operations in the
usual case where you just have ASCII characters. Or you could push
the ASCII special case code down into Character.toLowerCase and win
for the other people that use that method.
peter.kessler@Eng 1998-04-03