From 85bd763e09ab16b2aada55856d4b950b633e04fd Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 9 Jan 2016 18:09:38 +0000 Subject: [PATCH] NodeItem.walkTree(): refactor using existing getChild() Signed-off-by: Paul Campbell --- src/main/java/net/kemitix/node/NodeItem.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/net/kemitix/node/NodeItem.java b/src/main/java/net/kemitix/node/NodeItem.java index d35366a..2a6b4ba 100644 --- a/src/main/java/net/kemitix/node/NodeItem.java +++ b/src/main/java/net/kemitix/node/NodeItem.java @@ -110,10 +110,7 @@ public class NodeItem implements Node { @Override public Optional> walkTree(@NonNull final List path) { if (path.size() > 0) { - Optional> found = children.stream() - .filter((Node child) -> path.get(0) - .equals(child.getData())) - .findFirst(); + Optional> found = getChild(path.get(0)); if (found.isPresent()) { if (path.size() > 1) { return found.get().walkTree(path.subList(1, path.size()));