Node: {streamParents => parentStream} rename method

This commit is contained in:
Paul Campbell 2017-02-18 18:25:03 +00:00
parent b644fb9dd8
commit 081dfc7b37
2 changed files with 4 additions and 4 deletions

View file

@ -256,5 +256,5 @@ public interface Node<T> {
*
* @return a stream of the node's parents recursively until the root node
*/
Stream<Node<T>> streamParents();
Stream<Node<T>> parentStream();
}

View file

@ -377,8 +377,8 @@ class NodeItem<T> implements Node<T> {
}
@Override
public Stream<Node<T>> streamParents() {
return getParent().map(node -> Stream.concat(Stream.of(node), node.streamParents()))
public Stream<Node<T>> parentStream() {
return findParent().map(node -> Stream.concat(Stream.of(node), node.parentStream()))
.orElseGet(Stream::empty);
}
}