Ternary operator in if-statement?
- by Pindatjuh
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?