Re: Passing "<", ">", "=", etc as an argument to a method?
From: Anthony Borla (ajborla_at_bigpond.com)
Date: 11/28/03
- Next message: Michael G: "Re: swing components not showing"
- Previous message: Herman: "Re: Help with multiple file projects"
- In reply to: Stewart Gordon: "Re: Passing "<", ">", "=", etc as an argument to a method?"
- Next in thread: Raymond DeCampo: "Re: Passing "<", ">", "=", etc as an argument to a method?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 28 Nov 2003 20:27:46 GMT
"Stewart Gordon" <smjg_1998@yahoo.com> wrote in message
news:bq7uc2$n6r$1@sun-cc204.lut.ac.uk...
> While it was 28/11/03 1:37 am throughout the UK, Anthony
> Borla sprinkled little black dots on a white screen, and they
> fell thus:
>
> <snip>
> > if (relationalOp.equals("<"))
> > doLessThan(value1, value2)
> > else if (relationalOp.equals("="))
> > doEquals(value1, value2)
> > ...
>
> Why not make relationalOp a number, and save the overhead
> of doing string comparison?
>
> Define
>
> final static int EQ = 1;
> final static int GT = 2;
> final static int GTEQ = 3;
> final static int LT = 4;
> final static int LTEQ = 5;
> final static int NOTEQ = 6;
>
> and pass these values in.
>
Indeed, I fully agree ! However, my response was tailored to the OP's code:
'relationalOp' was a 'String' type.
I *did*, however, mention that:
'You can design a solution varying in complexity and
sophistication...'
and your solution is, most certainly, in this latter group :) !
Cheers,
Anthony Borla
- Next message: Michael G: "Re: swing components not showing"
- Previous message: Herman: "Re: Help with multiple file projects"
- In reply to: Stewart Gordon: "Re: Passing "<", ">", "=", etc as an argument to a method?"
- Next in thread: Raymond DeCampo: "Re: Passing "<", ">", "=", etc as an argument to a method?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]