@Nullable
  private static PsiType findPsiTypeForPredicate(@NotNull PsiExpression predicate) {
    PsiType typeParameter =
      PsiUtil.substituteTypeParameter(predicate.getType(), JAVA_UTIL_FUNCTION_PREDICATE, 0, false);
    if (typeParameter != null && !typeParameter.equalsToText(JAVA_LANG_OBJECT)) {
      return typeParameter;
    }

    final PsiMethodCallExpression call = ExpressionUtils.getCallForQualifier(predicate);
    if (PREDICATE_TEST.test(call)) {
      final PsiExpression[] argumentExpressions = call.getArgumentList().getExpressions();
      if (argumentExpressions.length != 1) {
        return null;
      }
      PsiExpression argument = PsiUtil.skipParenthesizedExprDown(argumentExpressions[0]);
      return getType(argument);
    }

    final PsiElement parent = PsiUtil.skipParenthesizedExprUp(predicate.getParent());
    if (parent instanceof PsiExpressionList) {
      return findPredicateExpectedType(predicate);
    }
    return null;
  }
@Nullable
  private static PsiType findPsiTypeForPredicate(@NotNull PsiExpression predicate)