IntentionAction (@NotNull PsiExpression expression) { final PsiElement parent = expression.getParent(); if (parent instanceof PsiForeachStatement forEach) { final PsiType type = expression.getType(); if (InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_UTIL_ITERATOR)) { return new ReplaceIteratorForEachLoopWithIteratorForLoopFix(forEach).asIntention(); } } return null; }