boolean (PsiMethod method) { if (!"next".equals(method.getName())) return false; final PsiClass containingClass = method.getContainingClass(); if (containingClass == null) return false; final PsiClass iterator = JavaPsiFacade.getInstance(method.getProject()).findClass(CommonClassNames.JAVA_UTIL_ITERATOR, method.getResolveScope()); return InheritanceUtil.isInheritorOrSelf(containingClass, iterator, true); }