Discuss / Java / 柯里化呢

柯里化呢

Topic source
        Function<Integer, Runnable> cr2 =
                (v1) -> () -> Main.staticMethod(v1);
        cr2.apply(1).run();
        
        Function<Integer, Function<Integer, Consumer<String>>> cr3 =
                (v1) -> (v2) -> (v3) -> Main.staticMethod(v1, v2, v3);
        cr3.apply(1).apply(2).accept("Consumer");

  • 1

Reply