boolean (GrExpression condition, GrExpression elseBranch) { if (condition instanceof GrMethodCall) condition = ((GrMethodCall)condition).getInvokedExpression(); if (!(condition instanceof GrReferenceExpression)) return false; final GrExpression qualifier = ((GrReferenceExpression)condition).getQualifier(); if (qualifier == null) return false; if (!PsiEquivalenceUtil.areElementsEquivalent(qualifier, elseBranch)) return false; final PsiType type = qualifier.getType(); if (type == null) return false; if (!InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_UTIL_LIST)) return false; final PsiElement resolved = ((GrReferenceExpression)condition).resolve(); return resolved instanceof PsiMethod && "isEmpty".equals(((PsiMethod)resolved).getName()) && ((PsiMethod)resolved).getParameterList().isEmpty(); }