Prefer n-ary and/or over stream collector.
Less copies, and possibility for short-circuiting,
which is not possible with stream collectors.
package org.sosy_lab.java_smt.basicimpl.tactics;
+import com.google.common.collect.Lists;
import java.util.List;
import org.sosy_lab.java_smt.api.BooleanFormula;
import org.sosy_lab.java_smt.api.BooleanFormulaManager;
@@ -113,18 +114,12 @@ public class NNFVisitor extends BooleanFormulaTransformationVisitor {
@Override
public BooleanFormula visitAnd(List<BooleanFormula> processedOperands) {
- return processedOperands
- .stream()
- .map(f -> bfmgr.visit(f, this))
- .collect(bfmgr.toDisjunction());
+ return bfmgr.or(Lists.transform(processedOperands, f -> bfmgr.visit(f, this)));
}
@Override
public BooleanFormula visitOr(List<BooleanFormula> processedOperands) {
- return processedOperands
- .stream()
- .map(f -> bfmgr.visit(f, this))
- .collect(bfmgr.toConjunction());
+ return bfmgr.and(Lists.transform(processedOperands, f -> bfmgr.visit(f, this)));
}
@Override
