allMatch
:Stream
中全部元素符合传入的predicate
返回 true
anyMatch
:Stream
中只要有一个元素符合传入的predicate
返回 true
noneMatch
:Stream
中没有一个元素符合传入的predicate
返回 true
List<String> list = new ArrayList<String>();
list.add("one"); list.add("two"); list.add("three"); list.add("four"); list.add("five"); Boolean bl = list.stream().anyMatch(x->x.length()==4); System.out.println(bl);
打印true
boolean anyMatch = catList.stream().parallel().noneMatch(e -> e.getId().equals(newArticleBO.getCategoryId()));
if (anyMatch) {
return R.en(ResultEnum.ARTICLE_CATEGORY_NOT_EXIST_ERROR);
}
声明:本站所有文章,如无特殊说明或标注,均为网络收集发布。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。