list筛选符合条件的数据作为新的list返回Lambda

2025-03-19 01:09:50

1、创建一个Student作为测试的集合对象

list筛选符合条件的数据作为新的list返回Lambda

2、创建Test类进行测试筛选符合条件的数据作为新的List返回List<Student> filterList = studentList .stream().filter((Student student) -> "王麻子".equals(student.getName())) .collect(Collectors.toList());

list筛选符合条件的数据作为新的list返回Lambda

3、输出结果

list筛选符合条件的数据作为新的list返回Lambda

4、so easy😊

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢