Re: EnumSet + contains: strange behavior



Oliver Wong wrote:

"Ulrich Scholz" <d4@xxxxxxxxxxx> wrote in message news:1149087937.551514.198980@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

if(result.contains(EnumTest.ONE));
{

There are semicolons after the if statement. Get rid of them.

I once spent a day or two trying to optimise some embedded code before I realised I had a semicolon in the middle of an if statement (pessimising the code would have actually made it sound better).

So, always put opening braces where god intended (and as instructed by the Java coding standard). And never treat them as optional in if/else/for/do/while statements (except in the else-if chain idiom).</code-style-police>

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
.