private static Collection<BasePsiNode<? extends PsiElement>> findFormsIn(Collection<? extends AbstractTreeNode<?>> children, List<? extends PsiFile> forms) {
    if (children.isEmpty() || forms.isEmpty()) return Collections.emptyList();
    List<BasePsiNode<? extends PsiElement>> result = new ArrayList<>();
    Set<PsiFile> psiFiles = new HashSet<>(forms);
    for (final AbstractTreeNode<?> child : children) {
      if (child instanceof BasePsiNode<? extends PsiElement> treeNode) {
        if (psiFiles.contains(treeNode.getValue())) {
          result.add(treeNode);
        }
      }
    }
    return result;
  }
private static Collection<BasePsiNode<? extends PsiElement>> findFormsIn(Collection<? extends AbstractTreeNode<?>> children, List<? extends PsiFile> forms)