AbstractTreeNode (Object[] nodes, Object element, Set<? super AbstractTreeNode<?>> visited) { for (Object node1 : nodes) { AbstractTreeNode<?> node = (AbstractTreeNode)node1; if (nodeIsAcceptableForElement(node, element)) return node; Object[] children = getChildren(node); if (visited.add(node)) { AbstractTreeNode<?> nodeResult = performDeepSearch(children, element, visited); if (nodeResult != null) { return nodeResult; } } } return null; }