@Nullable
    static MinMaxTerminalOperation create(@Nullable PsiExpression comparator, PsiType elementType, boolean max) {
      String sign = max ? ">" : "<";
      if(comparator == null) {
        if (PsiTypes.intType().equals(elementType) || PsiTypes.longType().equals(elementType)) {
          return new MinMaxTerminalOperation(elementType, "{item}" + sign + "{best}", null, max);
        }
        if (PsiTypes.doubleType().equals(elementType)) {
          return new MinMaxTerminalOperation(elementType, "java.lang.Double.compare({item},{best})" + sign + "0", null, max);
        }
      }
      else {
        FunctionHelper fn = FunctionHelper.create(comparator, 2);
        if(fn != null) {
          return new MinMaxTerminalOperation(elementType, "{comparator}" + sign + "0", fn, max);
        }
      }
      return null;
    }
@Nullable
    static MinMaxTerminalOperation create(@Nullable PsiExpression comparator, PsiType elementType, boolean max)