RFR: JDK-8032012, , String.toLowerCase/toUpperCase performance improvement
Xueming Shen
xueming.shen at oracle.com
Thu Feb 6 20:21:36 UTC 2014
On 02/06/2014 11:41 AM, Ulf Zibis wrote:
> Me again ;-)
>
>> On 02/06/2014 10:30 AM, Ulf Zibis wrote:
>>> But why not just coding:
>>> 2558 char ch = value[first];
>>> 2559 if (Character.isSurrogate(ch) {
>>> 2560 hasSurr = true;
>>> 2561 break;
>>> 2562 }
>>> 2563 if (ch != Character.toLowerCase((int)ch)) { // no need to check Character.ERROR
>>> 2564 break;
>>> 2565 }
>>>
>
> There already is Character.isUpperCase().
> I don't see, why (ch != Character.toLowerCase((int)ch) should perform better.
>
> But there is a bug in javadoc ;-)
> Your Report (Review ID: JI-9010267) - Error in doc of Character.isLowerCase/UpperCase(char)
>
> -Ulf
>
"ch != Character.toLowerCase((int)ch)" and "Character.isUpperCase(ch)" are
not equal for some code points...don't ask me why, please:-)
-Sherman
More information about the core-libs-dev
mailing list