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

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);
主站蜘蛛池模板: 抚顺市| 武安市| 古田县| 广南县| 库尔勒市| 崇阳县| 汉源县| 隆子县| 灵台县| 安西县| 宁南县| 衡阳市| 临高县| 青神县| 靖宇县| 嘉定区| 龙游县| 唐河县| 新泰市| 龙南县| 睢宁县| 高雄县| 双柏县| 平顶山市| 阿鲁科尔沁旗| 上蔡县| 综艺| 弋阳县| 满城县| 赤城县| 河池市| 南宫市| 禹州市| 澄江县| 浑源县| 南通市| 雷州市| 洱源县| SHOW| 内丘县| 鹿泉市|