Avoid negation in your ternary operation This product is not supported for your selected
Datadog site . (
).
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、
お気軽にご連絡ください 。
このルールを試す ID: java-code-style/confusing-ternary
Language: Java
Severity: Notice
Category: Code Style
Description Using a negative comparison in if
expressions with an else
clause can be confusing. Consider modifying your comparison by switching your if
and else` block statements.
Non-Compliant Code Examples public class Foo {
String bar ( int x , int y ) {
return ( x != y ) ? "diff" : "same" ;
}
}
Compliant Code Examples public class Foo {
String bar ( int x , int y ) {
return ( x == y ) ? "same" : "diff" ;
}
}
Seamless integrations. Try Datadog Code Security