diff --git a/src/main/java/net/kemitix/node/NodeItem.java b/src/main/java/net/kemitix/node/NodeItem.java index f338e9a..bc87179 100644 --- a/src/main/java/net/kemitix/node/NodeItem.java +++ b/src/main/java/net/kemitix/node/NodeItem.java @@ -287,6 +287,10 @@ public class NodeItem implements Node { public Node createChild(final T child) { if (child == null) { throw new NullPointerException("child"); + } + return new NodeItem<>(child, this); + } + @Override public Optional> findChildNamed(final String named) { if (named == null) { @@ -386,8 +390,4 @@ public class NodeItem implements Node { return name != null && name.length() > 0; } - } - return new NodeItem<>(child, this); - } - }