s.st">
您的位置:首页 >java的Match怎么使用
发布于2023-05-04 阅读(0)
扫一扫,手机访问
概念
1、各种Match操作可用于判断给定的Predicate是否符合Stream的要素。
2、Match操作是终端操作,返回布尔值。
实例
boolean anyStartsWithA =
stringCollection
.stream()
.anyMatch((s) -> s.startsWith("a"));
System.out.println(anyStartsWithA); // true
boolean allStartsWithA =
stringCollection
.stream()
.allMatch((s) -> s.startsWith("a"));
System.out.println(allStartsWithA); // false
boolean noneStartsWithZ =
stringCollection
.stream()
.noneMatch((s) -> s.startsWith("z"));
System.out.println(noneStartsWithZ); // true 上一篇:MySQL三层逻辑架构是什么
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
正版软件
正版软件
正版软件
正版软件
正版软件
1
2
3
7
9