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
|
@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");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue