Function接口练习之按照指定要求操作数据

public class FunctionTest {
    public static void main(String[] args) {
        String s = "林青霞,30";
        convert(s, s1 -> s1.split(",")[1], s1 -> Integer.parseInt(s1), integer -> integer + 70);
    }

    private static void convert(String s, Function<String, String> function1, Function<String, Integer> function2, Function<Integer, Integer> function3) {
        Integer i = function1.andThen(function2.andThen(function3)).apply(s);
        System.out.println(i);
    }
}

posted @ 2020-06-08 18:27  硬盘红了  阅读(128)  评论(0编辑  收藏  举报