PsiExpression (PsiExpression expression, @NotNull TypeEvaluator evaluator) { final PsiMethodCallExpression methodCall = (PsiMethodCallExpression)expression; PsiExpression argument = PseudoLambdaReplaceTemplate.replaceTypeParameters(methodCall.getArgumentList().getExpressions()[0]); if (argument == null) { return expression; } boolean isCollection = InheritanceUtil.isInheritor(PsiTypesUtil.getPsiClass(argument.getType()), CommonClassNames.JAVA_UTIL_COLLECTION); setReplaceByString(isCollection ? "($it$).stream()" : "java.util.stream.StreamSupport.stream(($it$).spliterator(), false)"); final PsiExpression replaced = super.replace(expression, evaluator); ParenthesesUtils.removeParentheses(replaced, false); return replaced; }