函数式接口理解及测试(2)

   @Test public void FunctionTest(){ Function<String,Apple> function=(String s)->{return new Apple(s,666);}; Apple app=function.apply("red"); System.out.println(app.getColor()+","+app.getWeight()); app=function.apply("green"); System.out.println(app.getColor()+","+app.getWeight()); }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/10d3fb968a030a2e7966b4d1cd7bac2c.html