Skip to main content

Posts

Showing posts from July, 2013

true, false... or *other*?

This was taken from real code :D The identifiers have been changed. if (isCertainCondition()) { // Fine so far... } else if (!isCertainCondition()) { // Are you kidding me?? // ... // Now for the clincher... } else { // ... }

if not a and not b or not b and not a...

I just found this code that I thought was humorous (identifiers changed to protect intellectual property): private boolean allFoosAreBarsOrBazs() { for (Foo foo: foos) { if (!(foo instanceof Bar)) { if (!(foo instanceof Baz)) { return false; } } if (!(foo instanceof Baz)) { if (!(foo instanceof Bar)) { return false; } } } return true; }