diff --git a/src/main/java/net/kemitix/node/Node.java b/src/main/java/net/kemitix/node/Node.java index ac16cb3..3e70032 100644 --- a/src/main/java/net/kemitix/node/Node.java +++ b/src/main/java/net/kemitix/node/Node.java @@ -249,7 +249,7 @@ public interface Node { * * @return a stream of all the nodes in the tree below this node */ - Stream> streamAll(); + Stream> stream(); /** * Returns a stream of all the node's ancestor nodes. diff --git a/src/main/java/net/kemitix/node/NodeItem.java b/src/main/java/net/kemitix/node/NodeItem.java index 2c96f3f..5b75c0a 100644 --- a/src/main/java/net/kemitix/node/NodeItem.java +++ b/src/main/java/net/kemitix/node/NodeItem.java @@ -371,9 +371,9 @@ class NodeItem implements Node { } @Override - public Stream> streamAll() { + public Stream> stream() { return Stream.concat(Stream.of(this), getChildren().stream() - .flatMap(Node::streamAll)); + .flatMap(Node::stream)); } @Override diff --git a/src/test/java/net/kemitix/node/ImmutableNodeItemTest.java b/src/test/java/net/kemitix/node/ImmutableNodeItemTest.java index 6f5491d..7454e05 100644 --- a/src/test/java/net/kemitix/node/ImmutableNodeItemTest.java +++ b/src/test/java/net/kemitix/node/ImmutableNodeItemTest.java @@ -437,14 +437,14 @@ public class ImmutableNodeItemTest { Nodes.namedChild("eight", "eight", n6); val immutableRoot = Nodes.asImmutable(node); //when - val result = immutableRoot.streamAll() + val result = immutableRoot.stream() .collect(Collectors.toList()); //then assertThat(result).as("full tree") .hasSize(9); // and assertThat(immutableRoot.getChild("one") - .streamAll() + .stream() .collect(Collectors.toList())).as("sub-tree") .hasSize(4); } diff --git a/src/test/java/net/kemitix/node/NodeItemTest.java b/src/test/java/net/kemitix/node/NodeItemTest.java index 9e8504c..1f25426 100644 --- a/src/test/java/net/kemitix/node/NodeItemTest.java +++ b/src/test/java/net/kemitix/node/NodeItemTest.java @@ -920,13 +920,13 @@ public class NodeItemTest { val n7 = Nodes.namedChild("seven", "seven", n5); val n8 = Nodes.namedChild("eight", "eight", n6); //when - val result = node.streamAll() + val result = node.stream() .collect(Collectors.toList()); //then assertThat(result).as("full tree") .contains(node, n1, n2, n3, n4, n5, n6, n7, n8); // and - assertThat(n1.streamAll() + assertThat(n1.stream() .collect(Collectors.toList())).as("sub-tree") .containsExactlyInAnyOrder(n1, n3, n5, n7); }