We do not need to update foundNode() if we do not find anything,
hence sync on optional directly. Improves interactions and solves
an Eclipse warning.
Change-Id: Ibc553d50d48ccd22480bdc33163364bc8a509c83
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
8c0f44e010826c36a232df28385dc591c7f878fd)
}
if (foundNode == null && parent instanceof ActionNodeContainer) {
- foundNode = ((ActionNodeContainer) parent).getActions().stream()
- .filter(act -> current.equals(act.getQName())).findFirst().orElse(null);
- if (foundNode != null && nextPath.iterator().hasNext()) {
- foundNode = findNodeIn(foundNode, nextPath);
+ final Optional<? extends SchemaNode> next = ((ActionNodeContainer) parent).getActions().stream()
+ .filter(act -> current.equals(act.getQName())).findFirst();
+ if (next.isPresent() && nextPath.iterator().hasNext()) {
+ foundNode = findNodeIn(next.orElseThrow(), nextPath);
}
}