Node { public @Nullable Node<T> find(T element) { if (Objects.equals(element, getElement())) { return this; } for (Node<T> child : getChildren()) { Node<T> result = child.find(element); if (result != null) { return result; } } return null; } Node(T element); Set<T> collectLeafs(Predicate<T> filter); @Nullable Node<T> find(T element); @Nullable List<Node<T>> trace(T element); Node<T> add(Node<T> node); void add(Collection<Node<T>> nodes); boolean isEmpty(); Set<Node<T>> getChildren(); T getElement(); @Override String toString();  }
@Test void find() { Node<String> e = NODE.find("E"); assertNotNull(e); assertEquals("E", e.getElement()); }