Use lambda instead of Comparator inheritance
@@ -34,7 +34,6 @@ import com.google.common.collect.SetMultimap;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -56,11 +55,7 @@ import static java.util.Objects.requireNonNull;
public class EqualityInference
{
// Ordering used to determine Expression preference when determining canonicals
- private static final Ordering<Expression> CANONICAL_ORDERING = Ordering.from(new Comparator<Expression>()
- {
- @Override
- public int compare(Expression expression1, Expression expression2)
- {
+ private static final Ordering<Expression> CANONICAL_ORDERING = Ordering.from((expression1, expression2) -> {
// Current cost heuristic:
// 1) Prefer fewer input symbols
// 2) Prefer smaller expression trees
@@ -71,7 +66,6 @@ public class EqualityInference
.compare(SubExpressionExtractor.extract(expression1).size(), SubExpressionExtractor.extract(expression2).size())
.compare(expression1.toString(), expression2.toString())
.result();
- }
});
private final SetMultimap<Expression, Expression> equalitySets; // Indexed by canonical expression
