Set<PsiMethod> (PsiMethod[] methods) { LinkedHashSet<PsiMethod> psiMethods = new LinkedHashSet<>(); for (PsiMethod m : methods) { if (m.hasModifierProperty(PsiModifier.STATIC) || m.hasModifierProperty(PsiModifier.PRIVATE)) { psiMethods.add(m); } else { PsiMethod[] superMethods = m.findDeepestSuperMethods(); if (superMethods.length > 0) { psiMethods.addAll(Arrays.asList(superMethods)); } else { psiMethods.add(m); } } } return psiMethods; }