java8学习

1、Function函数

public static void main(String[] args) {
      TestController t = new TestController();
      new TestController().aaa(3,value -> t.bbb(value));
}

public int bbb(int b){
        return b+100;
}

public void aaa(int a,Function<Integer,Integer> f){
      Object apply = f.apply(a);
      System.out.println("ggg:"+apply);
}

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0