From: "Jim Cheesman" <[EMAIL PROTECTED]>
> At 05:25 PM 30/08/01, you wrote:
> >Hi Jim
> >
> >This does seems kinda expensive, turning a String into an integer for
each
> >value thats being compared in a collection. I would have thought it would
be
> >better making a small object that contained the String and the number.
> >Something along the lines of
> >
> >public class NumericString implements Comparable {
> >     private String text;
> >     private int number;
> >
> >     ...
> >}
>
>
> But they're not all numbers... Some are text Strings - and only those that
> return true to isNumber are being converted...

So how about you only convert the numeric strings to NumericString objects?
Then you only have to do the isNumber check once per String object as well.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to