The scenario is there are different types of filters I have created which filters the list of some objects based on the property of the object.
So for that I have
You can simply add brackets to your lambda expression and add the logging statement right before the validation :
return event -> {
// LOG.info(event.getName() + " was filtered...") or whatever you use for logging.
return event.getPrizeCount() >= minimumNumOfPrizes;
}
Note that there exists a peek operation which is meant to be used mostly for logging on java streams :
events.stream()
.peek(event -> System.out.println("Filtering event" + event.getName()))
.filter(isEligible())
.collect(Collectors.toList());
but that is not helping here, as you need to log in AbstractEventFilter implementations.