当前位置:网站首页>Lambda termination operation find and match nonematch

Lambda termination operation find and match nonematch

2022-06-13 03:48:00 Leon_ Jinhai_ Sun

noneMatch

​ You can judge whether the elements in the flow do not meet the matching conditions . If they don't match, the result is true, Otherwise, the result is false

Example :

​ Judge whether writers have not exceeded 100 Year old .

//         Judge whether writers have not exceeded 100 Year old .
        List<Author> authors = getAuthors();

        boolean b = authors.stream()
                .noneMatch(author -> author.getAge() > 100);

        System.out.println(b);

原网站

版权声明
本文为[Leon_ Jinhai_ Sun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/164/202206130335183952.html