Stream anyMatch with List

Viewed 3983

I have a list of "items" and each item has a property of item.posts (which is a list of post-instances).

I want to filter my "item"-list by two properties:

If "item.isBig" and if any post of a item is enabled, then collect the returned Stream.

However, I don't know how to do the "anyMatch" with "i.getPosts#isEnabled".

items.stream()
     .filter(Item::isBig)
     .anyMatch(i.getPosts()->p.isEnabled) // this does not work
     .collect(Collectors.toList());
1 Answers
Related