List<User> list = new ArrayList<>();
list.add(new User(10,"zhangshan "));
list.add(new User(11,"zhangshan "));
list.add(new User(12,"zhangshan "));
list.add(new User(13,"zhangshan "));
List<User> list1 = list.stream().filter(str -> str.getAge() == 12).collect(Collectors.toList());
System.out.println(list1);
jdk1.8 filter用法
最新推荐文章于 2024-07-09 16:19:44 发布