官术网_书友最值得收藏!

Type inference in Java 8

Java, version 8, introduced functional programming, with lambda functions. The lambda expression can infer the type of its formal parameters. Consider the following code:

Consumer<String> consumer = (String s) -> System.out.println(s);

 

Instead of the preceding code, you could type the following code:

Consumer<String> consumer = s -> System.out.print(s);
主站蜘蛛池模板: 永寿县| 延津县| 潢川县| 逊克县| 姚安县| 竹北市| 遂川县| 闽清县| 合川市| 共和县| 河津市| 兴城市| 富宁县| 长宁区| 沁水县| 通许县| 洞口县| 莲花县| 黎川县| 耒阳市| 图木舒克市| 方城县| 宜兰县| 阿克苏市| 青州市| 耿马| 渑池县| 察隅县| 新巴尔虎右旗| 荆门市| 和龙市| 桃园市| 临邑县| 治县。| 祁阳县| 绥棱县| 云龙县| 土默特右旗| 山丹县| 祁东县| 荃湾区|