diff --git a/src/main/java/net/kemitix/node/NodeItem.java b/src/main/java/net/kemitix/node/NodeItem.java index b4a6eeb..ea26858 100644 --- a/src/main/java/net/kemitix/node/NodeItem.java +++ b/src/main/java/net/kemitix/node/NodeItem.java @@ -224,11 +224,7 @@ class NodeItem implements Node { @Override public Node getChild(final T child) { - Optional> optional = findChild(child); - if (optional.isPresent()) { - return optional.get(); - } - throw new NodeException("Child not found"); + return findChild(child).orElseThrow(() -> new NodeException("Child not found")); } /**