Remove an orElse(null) indirection
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / SchemaContextUtil.java
index a0c53dc1fbb631bbb9e58af19871e3708b33a986..ea1a9bf677ff8c0f804180eb2ada9961a6a8df86 100644 (file)
@@ -450,10 +450,10 @@ public final class SchemaContextUtil {
         }
 
         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);
             }
         }