void doSomething(String s){
if (s.equals("some thing"))
doA();
else if (s.equals("another thing"))
doB();
else
punt();
}Compare that with:
void doSomething(int i){
if (i == 0)
doA();
else if (i == 1)
doB();
else
punt();
}I would guess that the int equality can be calculated much more rapidly than the String equality. String equality might be so slow in comparison that developers should be wary of this practice in code where speed matters.
I am aware that sometimes there are big advantages to using Strings as branch-deciding parameters. I often favor this practice, but mostly in code that runs infrequently.
But I wonder if anybody knows better. I'm just guessing. Has anybody seen evidence that String equality can become a time hog?
Rich Hammer
_______________________________________________ Juglist mailing list [EMAIL PROTECTED] http://trijug.org/mailman/listinfo/juglist_trijug.org
