Giter Club home page Giter Club logo

Comments (1)

oldratlee avatar oldratlee commented on June 26, 2024 1

@Bughue

  • 注意,使用wrapBiFunction()方法,而不是废弃的wrap方法
  • TtlWrappers没有直接提供 BinaryOperatorwrap方法;
    如果你有需要,可以自己照着wrapBiFunction实现一个wrapBinaryOperator方法

下面是一些写法示例:

// 显式写上参数类型
TtlWrappers.wrapBiFunction((Integer x1, Integer x2) -> x1 + x2);
TtlWrappers.wrapBiFunction((Integer x1, Integer x2) -> {
    int sum = x1 + x2;
    return sum * 42;
});

BinaryOperator<Integer> f0 = (x1, x2) -> x1 + x2;
BiFunction<Integer, Integer, Integer> w0 = TtlWrappers.wrapBiFunction(f0);

BiFunction<Integer, Integer, Integer> w1 = TtlWrappers.wrapBiFunction((x1, x2) -> x1 + x2);
BiFunction<Integer, Integer, Integer> w2 = TtlWrappers.wrapBiFunction(Integer::sum);

BiFunction<Integer, Integer, Integer> f3 = (x1, x2) -> x1 + x2;
BiFunction<Integer, Integer, Integer> w3 = TtlWrappers.wrapBiFunction(f3);

PS: 上面这些是Java写法(Lambda语法)的区别。

from transmittable-thread-local.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.