Invert if condition for better readability
This refactoring inverts the if condition in removeDuplicates() method
for better readability of code and aligns with the intent described in
the javadoc for the method
@@ -377,12 +377,14 @@ public final class LogicalRowExpressions
List<RowExpression> result = new ArrayList<>();
for (RowExpression expression : expressions) {
- if (!determinismEvaluator.isDeterministic(expression)) {
+ if (determinismEvaluator.isDeterministic(expression)) {
+ if (!seen.contains(expression)) {
result.add(expression);
+ seen.add(expression);
+ }
}
- else if (!seen.contains(expression)) {
+ else {
result.add(expression);
- seen.add(expression);
}
}
