Maybe I can generalize this into a rule: if either of operands 2 or 3
to the ternary operator are boolean constants, don't use the ternary operator. a ? true : x == a || x a ? x : true == !a || x a ? false : x == !a && x a ? x : false == a && x
This commit is contained in:
@@ -54,8 +54,7 @@ public class TransformTest extends TestBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean equals (Object other) {
|
@Override public boolean equals (Object other) {
|
||||||
return !(other instanceof CustomType) ? false :
|
return (other instanceof CustomType) && value.equals(((CustomType)other).value);
|
||||||
value.equals(((CustomType)other).value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int hashCode () {
|
@Override public int hashCode () {
|
||||||
|
|||||||
Reference in New Issue
Block a user