PsiSubstitutor (@NotNull final PsiMethodReferenceExpression expression, @NotNull final PsiMethod method) { final PsiType[] typeArguments = expression.getTypeParameters(); if (typeArguments.length > 0) { final PsiTypeParameter[] typeParameters = method.getTypeParameters(); if (typeParameters.length == typeArguments.length) { final List<PsiTypeParameter> arguments = Arrays.asList(typeParameters); final List<PsiType> values = Arrays.asList(typeArguments); final Map<PsiTypeParameter, PsiType> substitutorMap = ContainerUtil.newHashMap(arguments, values); return PsiSubstitutor.createSubstitutor(substitutorMap); } } return PsiSubstitutor.EMPTY; }