It doesn't incur overhead at runtime because casts are there for the compiler. But it is unnecessary. All you need is
if (doSomething()) {
// do stuff
}
It's an idiosyncratic weirdness of somebody who didn't know the language very well and who hasn't read others' code to get an idea of what's good style.