commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todd V. Jonker" <t...@consciouscode.com>
Subject Re: [lang] CharUtils.isAscii methods and CharSet, two issues
Date Thu, 11 Mar 2004 20:26:28 GMT
As is stands, isAsciiAlphaUpper follows
DoTheSimplestThingThatCouldPossiblyWork but (perhaps) breaks
OnceAndOnlyOnce.

Still, I think the existing code is better.  Such things tend to be
called inside tight inner loops, and as such every bytecode counts.  Your
suggested rewrite adds no functional improvement while increasing the
execution time manyfold.  I strongly suggest leaving it as-is.


On Wed, 10 Mar 2004 19:41:55 -0500, "Gary Gregory"
<ggregory@seagullsw.com> said:
> Hello,
> 
> Looking at the new CharUtils class and its isAscii methods and the
> CharSet class, something feels slightly off.
> 
> (1)
> The first thing is that the isAscii* could be implemented in terms of
> already existing CharSet code. 
> 
> For example, in CharUtils:
> 
>     public static boolean isAsciiAlphaUpper(char ch) {
>         return (ch >= 'A' && ch <= 'Z');
>     }
> 
> Eating our own dog food:
> 
>     public static boolean isAsciiAlphaUpper(char ch) {
>         return CharSet.ASCII_ALPHA_UPPER.contains(ch);
>     }

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message