boolean (@Nullable PsiMethodCallExpression collect) { if (collect == null) return false; PsiExpression qualifier = collect.getMethodExpression().getQualifierExpression(); if (qualifier == null) return false; PsiType streamElementType = PsiUtil.substituteTypeParameter(qualifier.getType(), JAVA_UTIL_STREAM_STREAM, 0, false); PsiType collectionElementType = PsiUtil.substituteTypeParameter(collect.getType(), JAVA_UTIL_COLLECTION, 0, false); return streamElementType != null && collectionElementType != null && streamElementType.equals(collectionElementType); }