2021-06-08 14:23:48 +02:00
|
|
|
A conditional operator is sometimes cluttering readability, if one of the operand is a boolean literal it can be simplified in a boolean expression :
|
|
|
|
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,java]
|
2021-06-08 14:23:48 +02:00
|
|
|
----
|
|
|
|
boolean a = condition || exp;
|
|
|
|
boolean a = !condition && exp;
|
|
|
|
boolean a = !condition || exp;
|
|
|
|
boolean a = condition && exp;
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2021-06-08 14:23:48 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|