diff --git a/src/main/java/net/kemitix/node/NodeItem.java b/src/main/java/net/kemitix/node/NodeItem.java index a0c330d..f4f69b6 100644 --- a/src/main/java/net/kemitix/node/NodeItem.java +++ b/src/main/java/net/kemitix/node/NodeItem.java @@ -214,12 +214,9 @@ class NodeItem implements Node { @Override public Optional> findChild(@NonNull final T child) { return children.stream() - .filter(node -> { - final Optional d = node.getData(); - return d.isPresent() && d.get() - .equals(child); - }) - .findAny(); + .filter(node -> child.equals(node.getData() + .orElseGet(() -> null))) + .findFirst(); } @Override