GroupingTerminal (@NotNull TerminalBlock tb, @Nullable PsiMethodCallExpression computeIfAbsentCall, @Nullable PsiMethodCallExpression addCall) { if (!LIST_ADD.test(addCall) || !COMPUTE_IF_ABSENT.test(computeIfAbsentCall)) return null; PsiExpression[] args = computeIfAbsentCall.getArgumentList().getExpressions(); if (args.length != 2 || !(args[1] instanceof PsiLambdaExpression lambda)) return null; PsiExpression body = LambdaUtil.extractSingleExpressionFromBody(lambda.getBody()); if (ConstructionUtils.isEmptyCollectionInitializer(body)) { PsiLocalVariable variable = extractQualifierVariable(tb, computeIfAbsentCall); if (hasLambdaCompatibleEmptyInitializer(variable)) { PsiType mapType = variable.getType(); PsiType valueType = PsiUtil.substituteTypeParameter(mapType, JAVA_UTIL_MAP, 1, false); if (valueType == null) return null; AddingTerminal adding = new AddingTerminal(valueType, body, tb.getVariable(), addCall); InitializerUsageStatus status = getInitializerUsageStatus(variable, tb.getStreamSourceStatement()); return new GroupingTerminal(adding, variable, args[0], status); } } return null; }