SetParent: Simplify lambda expression

SonarLint reports:

Lambdas containing only one statement should not nest this statement
in a block (squid:S1602).

Change-Id: If42c79c135ba0639e1ff6e352e6a72252efc6d77
This commit is contained in:
David Pursehouse
2020-02-19 19:35:05 +09:00
parent 99626c1eb0
commit e4755a3275

View File

@@ -161,12 +161,7 @@ public class SetParent
throw new ResourceConflictException("cannot set parent to self");
}
if (Iterables.tryFind(
parent.tree(),
p -> {
return p.getNameKey().equals(project);
})
.isPresent()) {
if (Iterables.tryFind(parent.tree(), p -> p.getNameKey().equals(project)).isPresent()) {
throw new ResourceConflictException(
"cycle exists between " + project.get() + " and " + parent.getName());
}