diff --git a/src/main/java/net/kemitix/node/NodeItem.java b/src/main/java/net/kemitix/node/NodeItem.java index 3afbe8b..9e34a83 100644 --- a/src/main/java/net/kemitix/node/NodeItem.java +++ b/src/main/java/net/kemitix/node/NodeItem.java @@ -255,10 +255,10 @@ public class NodeItem implements Node { if (child == null) { throw new NullPointerException("child"); } - return children.stream() - .filter(n -> !n.isEmpty()) - .filter(n -> n.getData().get().equals(child)) - .findAny(); + return children.stream().filter(node -> { + final Optional d = node.getData(); + return d.isPresent() && d.get().equals(child); + }).findAny(); } @Override