Sho SHIMIZU
Committed by Gerrit Code Review

Simplify expression and statement

Change-Id: I66cc2bee3a929108c7b4451b3d64c9aac4dcf5d6
......@@ -53,12 +53,8 @@ public abstract class BooleanConstraint implements Constraint {
@Override
public boolean validate(Path path, LinkResourceService resourceService) {
for (Link link : path.links()) {
if (!isValid(link, resourceService)) {
return false;
}
}
return true;
return path.links().stream()
.allMatch(link -> isValid(link, resourceService));
}
}
......
......@@ -60,7 +60,7 @@ public class LinkTypeConstraint extends BooleanConstraint {
@Override
public boolean isValid(Link link, LinkResourceService resourceService) {
boolean contains = types.contains(link.type());
return isInclusive ? contains : !contains;
return isInclusive == contains;
}
/**
......