1. 程式人生 > >java8 方法引用與lambda

java8 方法引用與lambda

post dfa lis filter int pan length style ring

        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;

java8 方法引用與lambda