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

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);
主站蜘蛛池模板: 泽州县| 新闻| 鲜城| 石渠县| 射阳县| 黄浦区| 武邑县| 长乐市| 海门市| 曲麻莱县| 开封市| 任丘市| 五寨县| 开江县| 杭锦后旗| 云龙县| 周宁县| 仁化县| 台安县| 安丘市| 河西区| 大渡口区| 永济市| 高密市| 靖安县| 小金县| 台中县| 金秀| 浠水县| 和平县| 东方市| 南雄市| 无棣县| 嘉鱼县| 林周县| 长葛市| 广东省| 牡丹江市| 东山县| 车致| 博野县|