void (@NotNull HierarchyNodeDescriptor descriptor, @NotNull Set<? super PsiElement> out) { PsiElement element = getElementFromDescriptor(descriptor); if (element != null) { out.add(element.getNavigationElement()); } Object[] children = descriptor.getCachedChildren(); if (children == null) { return; } for (Object child : children) { if (child instanceof HierarchyNodeDescriptor childDescriptor) { collectElements(childDescriptor, out); } } }