I have one List of items. Inside the list item in my case, say BeanI have another list. My requirement is that, iterating over the parent list, I have to check the specific condition in the list obtained from Bean class getList()and return a boolean value there. Below is a demo of the code I want to achieve. How to do this in JAVA -8 using lambda.?
public boolean test(List<Bean> parentList) {
parentList.forEach(bean ->
bean.getList().stream().
filter(somePredicate).
findFirst().isPresent();
}
source
share