java-8 filter a list without creating a new list

前端 未结 1 530
一个人的身影
一个人的身影 2021-02-07 04:27

I\'m looking for the cleanest way to filter a list in Java-8, with a simple lambda Predicate, without creating a new list.

In particular, t

1条回答
  •  情话喂你
    2021-02-07 04:53

    beerDrinkers.removeIf(p -> p.getAge() <= 16);
    

    0 讨论(0)
提交回复
热议问题