序言

 

@Test
    public void test1() {
        List<Student> list = new ArrayList<>();
        Student s1 = new Student();
        s1.setName("a");
        s1.setAge(20);
        list.add(s1);

        Student s2 = new Student();
        s2.setName("b");
        s2.setAge(20);
        list.add(s2);

        Student s3 = new Student();
        s3.setName("c");
        s3.setAge(30);
        list.add(s3);

       List<Student> filterList = list.stream().filter(p -> p.getAge().equals(20)).collect(Collectors.toList());
       filterList.forEach(item->{
           System.out.println(item.getName());
       });

资料

https://blog.csdn.net/bitcarmanlee/article/details/70195403

SQL中那么多函数,Java8为什么还要提供重复的Stream方法,多此一举?

相关文章:

  • 2021-05-31
  • 2021-06-19
  • 2021-07-13
  • 2021-07-01
  • 2021-12-16
  • 2022-12-23
猜你喜欢
  • 2021-08-18
  • 2021-07-02
  • 2022-12-23
  • 2021-09-28
  • 2022-03-06
相关资源
相似解决方案