Merge "Use stream for AND evaluation"
This commit is contained in:
committed by
Android (Google) Code Review
commit
39b1641a24
@@ -88,11 +88,8 @@ final class RuleEvaluator {
|
||||
// NOT connector has only 1 formula attached.
|
||||
return !isMatch(openFormula.getFormulas().get(0), appInstallMetadata);
|
||||
case AND:
|
||||
boolean result = true;
|
||||
for (Formula subFormula : openFormula.getFormulas()) {
|
||||
result &= isMatch(subFormula, appInstallMetadata);
|
||||
}
|
||||
return result;
|
||||
return openFormula.getFormulas().stream().allMatch(
|
||||
subFormula -> isMatch(subFormula, appInstallMetadata));
|
||||
default:
|
||||
Slog.i(TAG, String.format("Returned no match for unknown connector %s",
|
||||
openFormula.getConnector()));
|
||||
|
||||
@@ -78,8 +78,8 @@ public final class Rule {
|
||||
return false;
|
||||
}
|
||||
Rule that = (Rule) o;
|
||||
return mFormula.equals(that.mFormula)
|
||||
&& mEffect == that.mEffect;
|
||||
return Objects.equals(mFormula, that.mFormula)
|
||||
&& Objects.equals(mEffect, that.mEffect);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user