PsiLocalVariable () { PsiMethodCallExpression call = getSingleMethodCall(); if (!isCallOf(call, CommonClassNames.JAVA_UTIL_COLLECTION, "add")) return null; PsiExpression[] args = call.getArgumentList().getExpressions(); if (args.length != 1 || !ExpressionUtils.isReferenceTo(args[0], myVariable)) return null; PsiReferenceExpression qualifier = tryCast(call.getMethodExpression().getQualifierExpression(), PsiReferenceExpression.class); if (qualifier == null) return null; PsiLocalVariable var = tryCast(qualifier.resolve(), PsiLocalVariable.class); if (var == null) return null; PsiNewExpression initializer = tryCast(var.getInitializer(), PsiNewExpression.class); if (initializer == null) return null; PsiExpressionList argumentList = initializer.getArgumentList(); if (argumentList == null || !argumentList.isEmpty() || ControlFlowUtils.getInitializerUsageStatus(var, getStreamSourceStatement()) == ControlFlowUtils.InitializerUsageStatus.UNKNOWN) { return null; } return var; }