MapLoopCondition (@NotNull PsiForeachStatement statement) { PsiExpression iteratedValue = statement.getIteratedValue(); PsiParameter iterParam = statement.getIterationParameter(); PsiMethodCallExpression iterCall = extractMapMethodCall(iteratedValue, "keySet"); if (iterCall != null) return create(iterParam, false, iterCall.getMethodExpression().getQualifierExpression()); iterCall = extractMapMethodCall(iteratedValue, "entrySet"); if (iterCall != null) return create(iterParam, true, iterCall.getMethodExpression().getQualifierExpression()); return null; }