On Thu, 7 Feb 2002, marc fleury wrote:

> when we do
>
> if (string.equals("this"))
>
> else if (string.equals("that"))
>
> how much slower is it than
>
> switch (stringAsInt)
> case THIS:
>
> case THAT:

If strings are final, then you can use ==, instead of the much slower
.equals().

A switch stmt is really nothing more than a series of if/elseif blocks.  So,
making all strings static/final, and using ==, should make for a win, without
making the code hard to read by using abstract ints.



_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to