boolean (PsiElement @NotNull [] elements) { return elements.length > 0 && Arrays.stream(elements).allMatch( e -> e instanceof PsiClass || e instanceof PsiJavaFile || e instanceof PsiDirectory || e instanceof PsiPackage); }