Conditional operator in if-statement?
Posted
by Pindatjuh
on Stack Overflow
See other posts from Stack Overflow
or by Pindatjuh
Published on 2010-05-12T23:29:16Z
Indexed on
2010/05/13
1:14 UTC
Read the original article
Hit count: 261
I've written the following if
-statement in Java:
if(methodName.equals("set" + this.name) ||
isBoolean() ? methodName.equals("is" + this.name) :
methodName.equals("get" + this.name)) {
...
}
Is this a good practice to write such expressions in if
, to separate state from condition? And can this expression be simplified?
© Stack Overflow or respective owner