@Nullable
  static Operation createIntermediate(@NotNull String name, PsiExpression @NotNull [] args,
                                      @NotNull ChainVariable outVar, @NotNull PsiType inType, boolean supportUnknownSources) {
    if(name.equals("distinct") && args.length == 0) {
      return new DistinctOperation();
    }
    if(name.equals("skip") && args.length == 1) {
      return new SkipOperation(args[0]);
    }
    if(name.equals("limit") && args.length == 1) {
      return new LimitOperation(args[0]);
    }
    if(name.equals("filter") && args.length == 1) {
      FunctionHelper fn = FunctionHelper.create(args[0], 1);
      return fn == null ? null : new FilterOperation(fn);
    }
    if(name.equals("takeWhile") && args.length == 1) {
      FunctionHelper fn = FunctionHelper.create(args[0], 1);
      return fn == null ? null : new TakeWhileOperation(fn);
    }
    if(name.equals("dropWhile") && args.length == 1) {
      FunctionHelper fn = FunctionHelper.create(args[0], 1);
      return fn == null ? null : new DropWhileOperation(fn);
    }
    if (name.equals("nonNull") && args.length == 0) { // StreamEx
      return new FilterOperation(new FunctionHelper.InlinedFunctionHelper(PsiTypes.booleanType(), 1, "{0} != null"));
    }
    if(name.equals("sorted") && !(inType instanceof PsiPrimitiveType)) {
      return new SortedOperation(args.length == 1 ? args[0] : null);
    }
    if(name.equals("peek") && args.length == 1) {
      FunctionHelper fn = FunctionHelper.create(args[0], 1);
      return fn == null ? null : new PeekOperation(fn);
    }
    if((name.equals("boxed") || name.equals("asLongStream") || name.equals("asDoubleStream")) && args.length == 0) {
      return new WideningOperation();
    }
    if ((name.equals("flatMap") || name.equals("flatMapToInt") || name.equals("flatMapToLong") || name.equals("flatMapToDouble")) &&
        args.length == 1) {
      return FlatMapOperation.from(outVar, args[0], supportUnknownSources);
    }
    if ((name.equals("map") ||
         name.equals("mapToInt") ||
         name.equals("mapToLong") ||
         name.equals("mapToDouble") ||
         name.equals("mapToObj")) && args.length == 1) {
      FunctionHelper fn = FunctionHelper.create(args[0], 1);
      return fn == null ? null : new MapOperation(fn);
    }
    return null;
  }
@Nullable
  static Operation createIntermediate(@NotNull String name, PsiExpression @NotNull [] args,
                                      @NotNull ChainVariable outVar, @NotNull PsiType inType, boolean supportUnknownSources)