java8 方法引用与lambda

        List<String> list = new ArrayList<>();

        //list.stream().filter((String s)->System.out.print(s);return s);
        String str="sadfasdf";
        //str.length()
        Function<String,Integer> func1= (s1)->s1.length();
        Function<String,Integer> func2= String::length;
        Function<String,Integer> func3= (s1)->str.length();
        Supplier<Integer> func4= str::length;

 

posted @ 2017-12-29 18:59  zslm___  阅读(168)  评论(0编辑  收藏  举报