NodeItem::getChild: simplify method

This commit is contained in:
Paul Campbell 2016-09-20 22:18:00 +01:00
parent f34f2a7200
commit f9aba88d0c

View file

@ -224,11 +224,7 @@ class NodeItem<T> implements Node<T> {
@Override @Override
public Node<T> getChild(final T child) { public Node<T> getChild(final T child) {
Optional<Node<T>> optional = findChild(child); return findChild(child).orElseThrow(() -> new NodeException("Child not found"));
if (optional.isPresent()) {
return optional.get();
}
throw new NodeException("Child not found");
} }
/** /**