Duplicate conditions in binary expressions are problematic because they introduce redundancy, make code harder to maintain, and can negatively impact performance.
Boolean conditions do not benefit from repeated checks of the same value. Even if this is done to account for multi-threading, there are better ways to do so other than repeating the same condition. Additionally, such code adds to clutter and reduces readability, allowing more serious bugs to slip through review.
Simple, clear code is always better and more efficient.
val foo = true
val bar = true
if (foo || bar || foo) {
}
Deduplicate or simplify components of the binary expression.
val foo = true
if (foo) {
// ...
}