NodeItem::getChild: simplify method
This commit is contained in:
parent
f34f2a7200
commit
f9aba88d0c
1 changed files with 1 additions and 5 deletions
|
@ -224,11 +224,7 @@ class NodeItem<T> implements Node<T> {
|
|||
|
||||
@Override
|
||||
public Node<T> getChild(final T child) {
|
||||
Optional<Node<T>> optional = findChild(child);
|
||||
if (optional.isPresent()) {
|
||||
return optional.get();
|
||||
}
|
||||
throw new NodeException("Child not found");
|
||||
return findChild(child).orElseThrow(() -> new NodeException("Child not found"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue